SkyOSFullCore / app.py
sky-meilin's picture
Update app.py
c18ecdb verified
Raw
History Blame Contribute Delete
4.32 kB
"""
app.py
SkyOS Dashboard Control Center – Simple Studio Edition
Komplett fokussiert auf Streaming, Chat & Direktnavigation
"""
import gradio as gr
from datetime import datetime
import zoneinfo
from persona_sky_meilin import (
AVATAR_PERSONA, AVATAR_JOBTITEL, COMPANY_NAME, SYSTEM_NAME,
LIGHTING_PROFILES, MATERIAL_PROFILES, build_studio_manifest
)
try:
from modules.avatar_streamer import AvatarStreamer
streamer = AvatarStreamer()
streamer.set_avatar(AVATAR_PERSONA)
AVATAR_READY = True
except Exception as e:
AVATAR_READY = False
tz_berlin = zoneinfo.ZoneInfo("Europe/Berlin")
def handle_interaction(text, audio, lighting, material):
if not AVATAR_READY:
return "Eingabe registriert. Render-Pipeline wird vorbereitet.", None
# Nutzt Text-Eingabe, fällt auf Audio-Verarbeitung zurück, falls Text leer ist
input_source = text if text else "Sprachbefehl verarbeitet."
manifest = build_studio_manifest(input_source, lighting, material)
streamer.start_stream()
streamer.send_message(f"Execute: {manifest}")
response = "Ich starte das Live-Streaming mit den gewünschten visuellen Anpassungen."
return [(input_source, response)], None
with gr.Blocks(theme=gr.themes.Soft(), title=f"{SYSTEM_NAME} Dashboard") as demo:
# ================= HEADER =================
with gr.Row():
gr.Markdown(f"# 🌌 {SYSTEM_NAME}{AVATAR_PERSONA} Studio")
# ================= CORE INTERFACE =================
with gr.Row():
# Linke Spalte: Streaming-Fenster (9:16)
with gr.Column(scale=1):
avatar_video_output = gr.Video(
label="Studio Stream (9:16)",
interactive=False
)
# Rechte Spalte: Chat & Steuerung
with gr.Column(scale=2):
chat_feed = gr.Chatbot(label="Chat-Interface (Aktiv wenn kein Stream)")
with gr.Row():
msg_input = gr.Textbox(placeholder="Nachricht oder Skript eingeben...", label="Texteingabe", scale=3)
audio_input = gr.Audio(sources=["microphone"], type="filepath", label="Spracheingabe", scale=2)
with gr.Row():
lighting_profile = gr.Dropdown(choices=list(LIGHTING_PROFILES.keys()), value="Golden Hour", label="☀️ Licht")
material_profile = gr.Dropdown(choices=list(MATERIAL_PROFILES.keys()), value="Lack & Leder (High-Gloss)", label="🧥 Outfit")
submit_btn = gr.Button("Senden & Streamen", variant="primary")
gr.HTML("<hr style='border: 1px solid #e5e7eb; margin: 20px 0;'>")
# ================= NAVIGATION (Ziele) =================
gr.Markdown("### 🏢 Bereiche öffnen")
with gr.Row():
# Die Buttons nutzen target="_blank" im HTML-Kontext, um isolierte Tabs zu öffnen
gr.HTML(f'<a href="/management" target="_blank"><button style="width:100%; padding:15px; background-color:#f3f4f6; border:1px solid #d1d5db; border-radius:8px; cursor:pointer;">💼 1. Management & Operations</button></a>')
gr.HTML(f'<a href="/client" target="_blank"><button style="width:100%; padding:15px; background-color:#f3f4f6; border:1px solid #d1d5db; border-radius:8px; cursor:pointer;">🤝 2. Client & Strategy</button></a>')
gr.HTML(f'<a href="/creation" target="_blank"><button style="width:100%; padding:15px; background-color:#f3f4f6; border:1px solid #d1d5db; border-radius:8px; cursor:pointer;">🎨 3. Creation & Content</button></a>')
with gr.Row():
gr.HTML(f'<a href="/technical" target="_blank"><button style="width:100%; padding:15px; background-color:#f3f4f6; border:1px solid #d1d5db; border-radius:8px; cursor:pointer;">📊 4. Technical & Performance</button></a>')
gr.HTML(f'<a href="/data" target="_blank"><button style="width:100%; padding:15px; background-color:#f3f4f6; border:1px solid #d1d5db; border-radius:8px; cursor:pointer;">⚡ 5. Tech & Data</button></a>')
# Event-Verknüpfung
submit_btn.click(
fn=handle_interaction,
inputs=[msg_input, audio_input, lighting_profile, material_profile],
outputs=[chat_feed, avatar_video_output]
)
if __name__ == "__main__":
demo.launch(server_name="0.0.0.0", server_port=7860)