Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,364 +1,105 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
import
|
| 3 |
-
import
|
| 4 |
-
import
|
| 5 |
-
|
| 6 |
-
from typing import List, Dict, Any
|
| 7 |
|
| 8 |
-
#
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
"app_status": {
|
| 13 |
-
"module_a": {"status": "stopped", "last_run": None},
|
| 14 |
-
"module_b": {"status": "running", "last_run": "2024-01-15 10:30"},
|
| 15 |
-
"module_c": {"status": "stopped", "last_run": None}
|
| 16 |
-
},
|
| 17 |
-
"settings": {
|
| 18 |
-
"theme": "default",
|
| 19 |
-
"notifications": True,
|
| 20 |
-
"auto_save": False
|
| 21 |
-
}
|
| 22 |
-
}
|
| 23 |
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
"""Simulate an AI assistant that can control the system"""
|
| 27 |
-
message_lower = message.lower()
|
| 28 |
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
return f"✅ Module {module} wurde gestartet."
|
| 35 |
-
return "❌ Bitte spezifizieren Sie welches Modul (module_a, module_b, module_c)."
|
| 36 |
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
if module in message_lower:
|
| 40 |
-
DATA_STORE["app_status"][module]["status"] = "stopped"
|
| 41 |
-
return f"🛑 Module {module} wurde gestoppt."
|
| 42 |
-
return "❌ Bitte spezifizieren Sie welches Modul."
|
| 43 |
-
|
| 44 |
-
elif "status" in message_lower:
|
| 45 |
-
status_msg = "📊 System Status:\n"
|
| 46 |
-
for module, info in DATA_STORE["app_status"].items():
|
| 47 |
-
icon = "🟢" if info["status"] == "running" else "🔴"
|
| 48 |
-
status_msg += f"{icon} {module}: {info['status']}"
|
| 49 |
-
if info["last_run"]:
|
| 50 |
-
status_msg += f" (Letzter Lauf: {info['last_run']})"
|
| 51 |
-
status_msg += "\n"
|
| 52 |
-
return status_msg
|
| 53 |
-
|
| 54 |
-
elif "hilfe" in message_lower or "help" in message_lower:
|
| 55 |
-
return """🤖 Verfügbare Befehle:
|
| 56 |
-
• 'Start module [name]' - Startet ein Modul
|
| 57 |
-
• 'Stop module [name]' - Stoppt ein Modul
|
| 58 |
-
• 'Status' - Zeigt Systemstatus
|
| 59 |
-
• 'Daten speichern [inhalt]' - Speichert Daten
|
| 60 |
-
• 'Liste Dateien' - Zeigt gespeicherte Dateien"""
|
| 61 |
-
|
| 62 |
-
else:
|
| 63 |
-
return f"🤖 Ich habe verstanden: '{message}'. Wie kann ich Ihnen helfen? Verwenden Sie 'Hilfe' für Befehle."
|
| 64 |
-
|
| 65 |
-
def process_chat(message: str, history: List[List[str]]) -> tuple:
|
| 66 |
-
"""Process chat message and update history"""
|
| 67 |
-
response = chat_response(message, history)
|
| 68 |
-
history.append({"role": "user", "content": message})
|
| 69 |
-
history.append({"role": "assistant", "content": response})
|
| 70 |
-
return "", history
|
| 71 |
-
|
| 72 |
-
def save_data_to_store(content: str, category: str) -> str:
|
| 73 |
-
"""Save data to the central storage"""
|
| 74 |
-
if not content:
|
| 75 |
-
return "❌ Kein Inhalt zum Speichern."
|
| 76 |
-
|
| 77 |
-
entry = {
|
| 78 |
-
"id": len(DATA_STORE["files"]) + 1,
|
| 79 |
-
"content": content,
|
| 80 |
-
"category": category,
|
| 81 |
-
"timestamp": datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
|
| 82 |
-
"size": len(content)
|
| 83 |
-
}
|
| 84 |
-
DATA_STORE["files"].append(entry)
|
| 85 |
-
return f"✅ Daten gespeichert (ID: {entry['id']})"
|
| 86 |
-
|
| 87 |
-
def load_data_store() -> List[List[Any]]:
|
| 88 |
-
"""Load data for display in dataframe"""
|
| 89 |
-
return [[f["id"], f["category"], f["timestamp"], f["size"], f["content"][:50] + "..."]
|
| 90 |
-
for f in DATA_STORE["files"]]
|
| 91 |
-
|
| 92 |
-
def toggle_module(module_name: str, current_status: str) -> tuple:
|
| 93 |
-
"""Toggle module status"""
|
| 94 |
-
new_status = "running" if current_status == "stopped" else "stopped"
|
| 95 |
-
DATA_STORE["app_status"][module_name]["status"] = new_status
|
| 96 |
-
if new_status == "running":
|
| 97 |
-
DATA_STORE["app_status"][module_name]["last_run"] = datetime.now().strftime("%Y-%m-%d %H:%M")
|
| 98 |
-
|
| 99 |
-
# Return updated buttons and status
|
| 100 |
-
color = "primary" if new_status == "running" else "secondary"
|
| 101 |
-
label = "Stoppen" if new_status == "running" else "Starten"
|
| 102 |
-
status_text = f"Status: {new_status.upper()}"
|
| 103 |
-
|
| 104 |
-
return gr.Button(variant=color, value=label), status_text, get_status_json()
|
| 105 |
-
|
| 106 |
-
def get_status_json() -> str:
|
| 107 |
-
"""Get current status as JSON"""
|
| 108 |
-
return json.dumps(DATA_STORE["app_status"], indent=2, ensure_ascii=False)
|
| 109 |
-
|
| 110 |
-
def export_data() -> str:
|
| 111 |
-
"""Export all data as JSON file"""
|
| 112 |
-
filename = f"data_export_{int(time.time())}.json"
|
| 113 |
-
with open(filename, "w", encoding="utf-8") as f:
|
| 114 |
-
json.dump(DATA_STORE, f, indent=2, ensure_ascii=False)
|
| 115 |
-
return filename
|
| 116 |
-
|
| 117 |
-
def clear_chat() -> List:
|
| 118 |
-
"""Clear chat history"""
|
| 119 |
-
DATA_STORE["chat_history"] = []
|
| 120 |
-
return []
|
| 121 |
-
|
| 122 |
-
# Custom Theme
|
| 123 |
-
custom_theme = gr.themes.Soft(
|
| 124 |
-
primary_hue="indigo",
|
| 125 |
-
secondary_hue="blue",
|
| 126 |
-
neutral_hue="slate",
|
| 127 |
-
font=gr.themes.GoogleFont("Inter"),
|
| 128 |
-
text_size="lg",
|
| 129 |
-
spacing_size="lg",
|
| 130 |
-
radius_size="md"
|
| 131 |
-
).set(
|
| 132 |
-
button_primary_background_fill="*primary_600",
|
| 133 |
-
button_primary_background_fill_hover="*primary_700",
|
| 134 |
-
block_title_text_weight="600",
|
| 135 |
-
block_shadow="*shadow_drop_lg"
|
| 136 |
-
)
|
| 137 |
-
|
| 138 |
-
# CSS for additional styling
|
| 139 |
-
custom_css = """
|
| 140 |
-
.gradio-container {
|
| 141 |
-
max-width: 1200px !important;
|
| 142 |
-
}
|
| 143 |
-
.header-text {
|
| 144 |
-
text-align: center;
|
| 145 |
-
margin-bottom: 2rem;
|
| 146 |
-
}
|
| 147 |
-
.control-card {
|
| 148 |
-
border: 1px solid var(--border-color-primary);
|
| 149 |
-
border-radius: var(--radius-lg);
|
| 150 |
-
padding: 1rem;
|
| 151 |
-
margin-bottom: 1rem;
|
| 152 |
-
}
|
| 153 |
-
.status-indicator {
|
| 154 |
-
font-weight: bold;
|
| 155 |
-
padding: 0.5rem;
|
| 156 |
-
border-radius: var(--radius-md);
|
| 157 |
-
}
|
| 158 |
-
"""
|
| 159 |
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 176 |
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 180 |
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
|
|
|
|
|
|
| 191 |
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
show_copy_button=True,
|
| 205 |
-
avatar_images=(None, "https://cdn-icons-png.flaticon.com/512/4712/4712035.png")
|
| 206 |
-
)
|
| 207 |
-
|
| 208 |
-
with gr.Row():
|
| 209 |
-
msg_input = gr.Textbox(
|
| 210 |
-
placeholder="Nachricht eingeben... (Tippe 'Hilfe' für Befehle)",
|
| 211 |
-
show_label=False,
|
| 212 |
-
container=False,
|
| 213 |
-
scale=8
|
| 214 |
-
)
|
| 215 |
-
send_btn = gr.Button("Senden", variant="primary", scale=1)
|
| 216 |
-
clear_btn = gr.Button("🗑️", variant="secondary", scale=0)
|
| 217 |
-
|
| 218 |
-
with gr.Accordion("Verfügbare Befehle", open=False):
|
| 219 |
-
gr.Markdown("""
|
| 220 |
-
- `Start module [a/b/c]` - Startet ein Modul
|
| 221 |
-
- `Stop module [a/b/c]` - Stoppt ein Modul
|
| 222 |
-
- `Status` - Zeigt Systemstatus
|
| 223 |
-
- `Hilfe` - Zeigt alle Befehle
|
| 224 |
-
""")
|
| 225 |
-
|
| 226 |
-
# DATA STORAGE MODULE
|
| 227 |
-
with gr.Column(visible=False) as data_module:
|
| 228 |
-
gr.Markdown("## 💾 Zentraler Datenspeicher")
|
| 229 |
-
gr.Markdown("Verwalten Sie Daten und Dateien zentral.")
|
| 230 |
-
|
| 231 |
-
with gr.Row():
|
| 232 |
-
with gr.Column(scale=2):
|
| 233 |
-
data_input = gr.Textbox(
|
| 234 |
-
label="Daten eingeben",
|
| 235 |
-
placeholder="Text, JSON, Konfigurationen...",
|
| 236 |
-
lines=5
|
| 237 |
-
)
|
| 238 |
-
data_category = gr.Dropdown(
|
| 239 |
-
choices=["Konfiguration", "Log", "Benutzerdaten", "System", "Sonstiges"],
|
| 240 |
-
label="Kategorie",
|
| 241 |
-
value="Sonstiges"
|
| 242 |
-
)
|
| 243 |
-
save_btn = gr.Button("💾 Speichern", variant="primary")
|
| 244 |
-
save_status = gr.Textbox(label="Status", interactive=False)
|
| 245 |
-
|
| 246 |
-
with gr.Column(scale=3):
|
| 247 |
-
data_table = gr.Dataframe(
|
| 248 |
-
headers=["ID", "Kategorie", "Zeitstempel", "Größe", "Vorschau"],
|
| 249 |
-
label="Gespeicherte Daten",
|
| 250 |
-
interactive=False,
|
| 251 |
-
height=300
|
| 252 |
-
)
|
| 253 |
-
refresh_btn = gr.Button("🔄 Aktualisieren")
|
| 254 |
-
export_btn = gr.Button("📥 Exportieren (JSON)", variant="secondary")
|
| 255 |
-
export_file = gr.File(label="Export", visible=False)
|
| 256 |
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
gr.
|
| 260 |
-
gr.
|
| 261 |
-
|
| 262 |
-
with gr.Row():
|
| 263 |
-
# Module A Control
|
| 264 |
-
with gr.Column(variant="panel"):
|
| 265 |
-
gr.Markdown("### Module A")
|
| 266 |
-
status_a = gr.Textbox(value="Status: STOPPED", label=None, interactive=False)
|
| 267 |
-
toggle_a = gr.Button("Starten", variant="secondary")
|
| 268 |
-
info_a = gr.Textbox(value="Letzter Lauf: -", label=None, interactive=False)
|
| 269 |
-
|
| 270 |
-
# Module B Control
|
| 271 |
-
with gr.Column(variant="panel"):
|
| 272 |
-
gr.Markdown("### Module B")
|
| 273 |
-
status_b = gr.Textbox(value="Status: RUNNING", label=None, interactive=False)
|
| 274 |
-
toggle_b = gr.Button("Stoppen", variant="primary")
|
| 275 |
-
info_b = gr.Textbox(value="Letzter Lauf: 2024-01-15 10:30", label=None, interactive=False)
|
| 276 |
-
|
| 277 |
-
# Module C Control
|
| 278 |
-
with gr.Column(variant="panel"):
|
| 279 |
-
gr.Markdown("### Module C")
|
| 280 |
-
status_c = gr.Textbox(value="Status: STOPPED", label=None, interactive=False)
|
| 281 |
-
toggle_c = gr.Button("Starten", variant="secondary")
|
| 282 |
-
info_c = gr.Textbox(value="Letzter Lauf: -", label=None, interactive=False)
|
| 283 |
-
|
| 284 |
-
gr.Markdown("---")
|
| 285 |
-
gr.Markdown("### 📊 System Status (JSON)")
|
| 286 |
-
status_json = gr.Code(value=get_status_json(), language="json", lines=10)
|
| 287 |
-
|
| 288 |
-
with gr.Row():
|
| 289 |
-
global_stop = gr.Button("🛑 Alle Stoppen", variant="stop")
|
| 290 |
-
global_start = gr.Button("▶️ Alle Starten", variant="primary")
|
| 291 |
-
reload_config = gr.Button("🔄 Konfiguration neu laden")
|
| 292 |
-
|
| 293 |
-
# Event Handlers
|
| 294 |
-
|
| 295 |
-
# Navigation
|
| 296 |
-
def show_module(module_name):
|
| 297 |
-
return {
|
| 298 |
-
chat_module: gr.Column(visible=(module_name == "chat")),
|
| 299 |
-
data_module: gr.Column(visible=(module_name == "data")),
|
| 300 |
-
control_module: gr.Column(visible=(module_name == "control")),
|
| 301 |
-
nav_chat: gr.Button(variant="primary" if module_name == "chat" else "secondary"),
|
| 302 |
-
nav_data: gr.Button(variant="primary" if module_name == "data" else "secondary"),
|
| 303 |
-
nav_control: gr.Button(variant="primary" if module_name == "control" else "secondary")
|
| 304 |
-
}
|
| 305 |
-
|
| 306 |
-
nav_chat.click(lambda: show_module("chat"), None,
|
| 307 |
-
[chat_module, data_module, control_module, nav_chat, nav_data, nav_control])
|
| 308 |
-
nav_data.click(lambda: show_module("data"), None,
|
| 309 |
-
[chat_module, data_module, control_module, nav_chat, nav_data, nav_control])
|
| 310 |
-
nav_control.click(lambda: show_module("control"), None,
|
| 311 |
-
[chat_module, data_module, control_module, nav_chat, nav_data, nav_control])
|
| 312 |
|
| 313 |
-
|
| 314 |
-
send_btn.click(process_chat, [msg_input, chatbot], [msg_input, chatbot], api_visibility="public")
|
| 315 |
-
msg_input.submit(process_chat, [msg_input, chatbot], [msg_input, chatbot], api_visibility="public")
|
| 316 |
-
clear_btn.click(clear_chat, None, chatbot)
|
| 317 |
|
| 318 |
-
|
| 319 |
-
|
| 320 |
-
|
| 321 |
-
|
| 322 |
-
|
| 323 |
|
| 324 |
-
|
| 325 |
-
|
| 326 |
-
|
| 327 |
-
|
| 328 |
-
|
| 329 |
-
|
| 330 |
-
|
| 331 |
-
|
| 332 |
-
# Global controls
|
| 333 |
-
def stop_all():
|
| 334 |
-
for module in DATA_STORE["app_status"]:
|
| 335 |
-
DATA_STORE["app_status"][module]["status"] = "stopped"
|
| 336 |
-
return [gr.Button(variant="secondary", value="Starten")] * 3 + \
|
| 337 |
-
[gr.Textbox(value="Status: STOPPED")] * 3 + \
|
| 338 |
-
[get_status_json()]
|
| 339 |
-
|
| 340 |
-
def start_all():
|
| 341 |
-
for module in DATA_STORE["app_status"]:
|
| 342 |
-
DATA_STORE["app_status"][module]["status"] = "running"
|
| 343 |
-
DATA_STORE["app_status"][module]["last_run"] = datetime.now().strftime("%Y-%m-%d %H:%M")
|
| 344 |
-
return [gr.Button(variant="primary", value="Stoppen")] * 3 + \
|
| 345 |
-
[gr.Textbox(value="Status: RUNNING")] * 3 + \
|
| 346 |
-
[get_status_json()]
|
| 347 |
-
|
| 348 |
-
global_stop.click(stop_all, None, [toggle_a, toggle_b, toggle_c, status_a, status_b, status_c, status_json])
|
| 349 |
-
global_start.click(start_all, None, [toggle_a, toggle_b, toggle_c, status_a, status_b, status_c, status_json])
|
| 350 |
-
reload_config.click(get_status_json, None, status_json)
|
| 351 |
|
| 352 |
-
# Launch
|
| 353 |
-
|
| 354 |
-
theme=custom_theme,
|
| 355 |
-
css=custom_css,
|
| 356 |
-
title="Zentrale Steuerungskonsole",
|
| 357 |
-
footer_links=[
|
| 358 |
-
{"label": "Built with anycoder", "url": "https://huggingface.co/spaces/akhaliq/anycoder"},
|
| 359 |
-
{"label": "API", "url": "/api"},
|
| 360 |
-
{"label": "Einstellungen", "url": "#"}
|
| 361 |
-
],
|
| 362 |
-
pwa=True, # Enable as Progressive Web App
|
| 363 |
-
show_error=True
|
| 364 |
-
)
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
import random
|
| 3 |
+
from PIL import Image, ImageDraw, ImageFont
|
| 4 |
+
import io
|
| 5 |
+
import base64
|
|
|
|
| 6 |
|
| 7 |
+
# Deine Assets (erweitert)
|
| 8 |
+
images = ["file:12", "file:71"] # Cert-Vorlagen
|
| 9 |
+
videos = ["file:97", "file:98", "file:99"]
|
| 10 |
+
tasks = ["Cage anziehen", "Loser Pics", "Pegging", "Toilet-Asche", "Anschaffen", "Halsband", "Brandmark"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
+
def generate_cert_and_blogimage(name, bewerbung, tribut, custom_image=None):
|
| 13 |
+
"""Erweiterte Funktion: Cert + Blog-Image mit Upload-Option"""
|
|
|
|
|
|
|
| 14 |
|
| 15 |
+
# Tribut-Validierung
|
| 16 |
+
try:
|
| 17 |
+
tribut = float(tribut or 0)
|
| 18 |
+
except (TypeError, ValueError):
|
| 19 |
+
return "❌ Ungültiger Betrag.", None, None, None
|
|
|
|
|
|
|
| 20 |
|
| 21 |
+
if tribut < 35:
|
| 22 |
+
return "❌ Tribut unzureichend! Mind. 35€ für Sissy-Zertifikat.", None, None, None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
+
# 1. SISSY CERT generieren
|
| 25 |
+
cert_img = Image.new("RGB", (800, 600), color="black")
|
| 26 |
+
draw = ImageDraw.Draw(cert_img)
|
| 27 |
+
font = ImageFont.load_default()
|
| 28 |
+
|
| 29 |
+
cert_text = (
|
| 30 |
+
f"Sissy Zertifikat\n"
|
| 31 |
+
f"Name: {name}\n"
|
| 32 |
+
f"Bewerbung: {bewerbung[:50]}...\n"
|
| 33 |
+
f"Goddess Annabelle\n"
|
| 34 |
+
f"Task: {random.choice(tasks)}"
|
| 35 |
+
)
|
| 36 |
+
draw.text((100, 100), cert_text, fill="red", font=font)
|
| 37 |
+
|
| 38 |
+
task = random.choice(tasks)
|
| 39 |
+
video = random.choice(videos)
|
| 40 |
+
|
| 41 |
+
# 2. BLOG-IMAGE generieren (mit Custom Upload Overlay)
|
| 42 |
+
if custom_image:
|
| 43 |
+
# Custom Bild als Basis nehmen (Resize)
|
| 44 |
+
blog_img = custom_image.resize((1200, 800))
|
| 45 |
+
draw_blog = ImageDraw.Draw(blog_img)
|
| 46 |
|
| 47 |
+
# Overlay: Text + Cert-Snippet
|
| 48 |
+
overlay_text = (
|
| 49 |
+
f"NEU! Sissy Cert #{name[:8]}\n"
|
| 50 |
+
f"Task: {task}\n"
|
| 51 |
+
f"Blog ready – 35€ Tribut\n"
|
| 52 |
+
f"GoddessAnnabelle.com"
|
| 53 |
+
)
|
| 54 |
+
draw_blog.text((50, 50), overlay_text, fill="white", font=font, stroke_width=2, stroke_fill="black")
|
| 55 |
|
| 56 |
+
# Kleines Cert-Snippet unten rechts einfügen
|
| 57 |
+
cert_thumb = cert_img.resize((200, 150))
|
| 58 |
+
blog_img.paste(cert_thumb, (900, 600))
|
| 59 |
|
| 60 |
+
else:
|
| 61 |
+
# Default Blog-Image aus Assets
|
| 62 |
+
blog_img = Image.new("RGB", (1200, 800), color="#1a0033")
|
| 63 |
+
draw_blog = ImageDraw.Draw(blog_img)
|
| 64 |
+
draw_blog.text((100, 100), f"Sissy {name} approved!\n{task} Task unlocked\n35€ BNWO Entry",
|
| 65 |
+
fill="magenta", font=font)
|
| 66 |
+
|
| 67 |
+
status = f"✅ Zertifikat + Blog-Image ready! Task: {task}"
|
| 68 |
|
| 69 |
+
return status, cert_img, video, blog_img
|
| 70 |
+
|
| 71 |
+
# Erweiterte Gradio Interface
|
| 72 |
+
with gr.Blocks(title="🖤 Goddess Annabelle Sissy Suite 🖤") as iface:
|
| 73 |
+
gr.Markdown("# Sissy Cert + Blog-Image Generator\n35€ → Zertifikat, Task-Reel **+ Social-Ready Blogbild**")
|
| 74 |
+
|
| 75 |
+
with gr.Row():
|
| 76 |
+
with gr.Column(scale=1):
|
| 77 |
+
name = gr.Textbox(label="Dein Sissy-Name", placeholder="sissy_loser_420")
|
| 78 |
+
bewerbung = gr.Textbox(label="Aussagekräftige Bewerbung", lines=4)
|
| 79 |
+
tribut = gr.Number(label="Tribut (€)", value=0, minimum=0)
|
| 80 |
+
custom_img = gr.Image(type="pil", label="📸 Custom Blog-Bild hochladen (optional)")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
|
| 82 |
+
with gr.Column(scale=1):
|
| 83 |
+
status = gr.Textbox(label="Status", interactive=False)
|
| 84 |
+
cert_img = gr.Image(label="✅ Dein Sissy Cert")
|
| 85 |
+
video_reel = gr.Video(label="🎥 Task Reel")
|
| 86 |
+
blog_img = gr.Image(label="🖼️ Social/Blog-Image (1200x800 ready!)")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
|
| 88 |
+
submit_btn = gr.Button("Generate Cert + Blog-Image", variant="primary", size="lg")
|
|
|
|
|
|
|
|
|
|
| 89 |
|
| 90 |
+
submit_btn.click(
|
| 91 |
+
fn=generate_cert_and_blogimage,
|
| 92 |
+
inputs=[name, bewerbung, tribut, custom_img],
|
| 93 |
+
outputs=[status, cert_img, video_reel, blog_img]
|
| 94 |
+
)
|
| 95 |
|
| 96 |
+
gr.Markdown("""
|
| 97 |
+
**Features:**
|
| 98 |
+
- Personalisierte Certs mit Tasks
|
| 99 |
+
- Social-ready Blog-Bilder (Instagram/Twitter/WordPress)
|
| 100 |
+
- Custom Upload → Overlay mit Cert/Task
|
| 101 |
+
- BNWO optimized! 🚀
|
| 102 |
+
""")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
|
| 104 |
+
# Launch (server=False für privates Testing)
|
| 105 |
+
iface.launch(server_name="0.0.0.0", server_port=7860, share=False, debug=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|