Spaces:
Runtime error
Runtime error
| import os | |
| import gradio as gr | |
| from orchestrator import SuperOrchestrator, SuperConfig | |
| def main(): | |
| config = SuperConfig( | |
| deepseek_api_key=os.getenv("DEEPSEEK_KEY", ""), | |
| openai_api_key=os.getenv("OPENAI_KEY", ""), | |
| hf_token=os.getenv("HF_TOKEN", ""), | |
| enable_local_models=True, | |
| debug_mode=True | |
| ) | |
| orb = SuperOrchestrator(config) | |
| def responde(message, history, task_type): | |
| resp = orb.process(message, task_type) | |
| history.append([message, resp.content]) | |
| return history, history | |
| with gr.Blocks() as demo: | |
| gr.Markdown("# 馃 Super Chatbot Multi-Agente") | |
| chat = gr.Chatbot() | |
| with gr.Row(): | |
| msg = gr.Textbox(label="Escribe tu mensaje", placeholder="驴Qu茅 necesitas?") | |
| task_type = gr.Dropdown( | |
| choices=[ | |
| "conversaci贸n","c贸digo","depuraci贸n","explicaci贸n_c贸digo", | |
| "razonamiento_matem谩tico","traducci贸n","generaci贸n_imagen", | |
| "resumen","investigaci贸n","escritura_creativa" | |
| ], | |
| value="conversaci贸n", | |
| label="Tipo de tarea" | |
| ) | |
| enviar = gr.Button("Enviar") | |
| limpiar = gr.Button("Limpiar chat") | |
| enviar.click(responde, inputs=[msg, chat, task_type], outputs=[chat, chat]) | |
| msg.submit(responde, inputs=[msg, chat, task_type], outputs=[chat, chat]) | |
| limpiar.click(lambda: [], outputs=[chat]) | |
| demo.launch() | |
| if __name__ == "__main__": | |
| main() | |