Tsitsi19 commited on
Commit
3ec8e41
·
verified ·
1 Parent(s): ed8b215

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -16
app.py CHANGED
@@ -1,26 +1,19 @@
1
  import gradio as gr
2
- import os
3
  from agent_zero import AgentZero
4
 
5
- # On force l'initialisation de TON agent
 
6
  agent = AgentZero()
7
 
8
- def chat_fn(message, history):
9
- # On appelle explicitement TON modèle Qwen 2.5
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
- # Interface simplifiée mais puissante
20
  demo = gr.ChatInterface(
21
- fn=chat_fn,
22
- title="AGENT ZÉRO - COMMAND CENTER",
23
- description="Statut : Connecté à Qwen 2.5-0.5B-Instruct",
 
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__":