Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,26 +1,19 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
import os
|
| 3 |
from agent_zero import AgentZero
|
| 4 |
|
| 5 |
-
#
|
|
|
|
| 6 |
agent = AgentZero()
|
| 7 |
|
| 8 |
-
def
|
| 9 |
-
|
| 10 |
-
try:
|
| 11 |
-
response = agent.run(message)
|
| 12 |
-
# Si la réponse est une liste (cas du batch_decode), on prend le premier élément
|
| 13 |
-
if isinstance(response, list):
|
| 14 |
-
response = response[0]
|
| 15 |
-
return response
|
| 16 |
-
except Exception as e:
|
| 17 |
-
return f"Erreur technique : {str(e)}"
|
| 18 |
|
| 19 |
-
#
|
| 20 |
demo = gr.ChatInterface(
|
| 21 |
-
fn=
|
| 22 |
-
title="
|
| 23 |
-
description="
|
|
|
|
| 24 |
)
|
| 25 |
|
| 26 |
if __name__ == "__main__":
|
|
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
from agent_zero import AgentZero
|
| 3 |
|
| 4 |
+
# Initialisation UNIQUE au lancement
|
| 5 |
+
print("Démarrage du cerveau Qwen...")
|
| 6 |
agent = AgentZero()
|
| 7 |
|
| 8 |
+
def respond(message, history):
|
| 9 |
+
return agent.run(message)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
+
# Utilisation de ChatInterface (Standard Gradio 5)
|
| 12 |
demo = gr.ChatInterface(
|
| 13 |
+
fn=respond,
|
| 14 |
+
title="CENTRE DE COMMANDEMENT AGENT ZÉRO",
|
| 15 |
+
description="Connecté localement à Qwen 2.5-0.5B-Instruct",
|
| 16 |
+
examples=["Qui es-tu ?", "Analyse le fichier app.py"]
|
| 17 |
)
|
| 18 |
|
| 19 |
if __name__ == "__main__":
|