Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,12 +1,76 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
|
|
|
|
| 3 |
def synaptis(prompt):
|
| 4 |
-
|
| 5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
with gr.Blocks() as demo:
|
| 7 |
gr.Markdown("# 🧠 SYNAPTIS")
|
|
|
|
|
|
|
| 8 |
inp = gr.Textbox(label="Ta demande")
|
| 9 |
-
out = gr.Textbox(label="Réponse")
|
|
|
|
| 10 |
btn = gr.Button("Analyser")
|
| 11 |
btn.click(fn=synaptis, inputs=inp, outputs=out)
|
| 12 |
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
+
# --- CERVEAU ---
|
| 4 |
def synaptis(prompt):
|
| 5 |
+
p = prompt.lower()
|
| 6 |
|
| 7 |
+
# MODE STRATÉGIE
|
| 8 |
+
if "stratégie" in p:
|
| 9 |
+
return f"""🧠 Analyse stratégique :
|
| 10 |
+
|
| 11 |
+
1. Objectif :
|
| 12 |
+
→ {prompt}
|
| 13 |
+
|
| 14 |
+
2. Contraintes possibles :
|
| 15 |
+
- Temps
|
| 16 |
+
- Ressources
|
| 17 |
+
- Risques
|
| 18 |
+
|
| 19 |
+
3. Plan d’action :
|
| 20 |
+
- Étape 1 : Analyse
|
| 21 |
+
- Étape 2 : Décision
|
| 22 |
+
- Étape 3 : Exécution
|
| 23 |
+
|
| 24 |
+
4. Recommandation :
|
| 25 |
+
→ Prioriser les actions à fort impact."""
|
| 26 |
+
|
| 27 |
+
# MODE RÉSUMÉ
|
| 28 |
+
elif "résumé" in p:
|
| 29 |
+
return "📄 Résumé :\n" + prompt[:200] + "..."
|
| 30 |
+
|
| 31 |
+
# MODE IDÉES
|
| 32 |
+
elif "idée" in p or "créer" in p:
|
| 33 |
+
return f"""💡 Génération d’idées :
|
| 34 |
+
|
| 35 |
+
Sujet : {prompt}
|
| 36 |
+
|
| 37 |
+
- Idée 1 : Approche innovante
|
| 38 |
+
- Idée 2 : Optimisation existante
|
| 39 |
+
- Idée 3 : Solution disruptive
|
| 40 |
+
"""
|
| 41 |
+
|
| 42 |
+
# MODE SIMULATION
|
| 43 |
+
elif "simulation" in p:
|
| 44 |
+
return f"""🎯 Simulation :
|
| 45 |
+
|
| 46 |
+
Scénario : {prompt}
|
| 47 |
+
|
| 48 |
+
Résultat probable :
|
| 49 |
+
→ Succès si bonne exécution
|
| 50 |
+
→ Risque si manque d’anticipation
|
| 51 |
+
"""
|
| 52 |
+
|
| 53 |
+
# PAR DÉFAUT
|
| 54 |
+
else:
|
| 55 |
+
return f"""🔍 Analyse générale :
|
| 56 |
+
|
| 57 |
+
Entrée : {prompt}
|
| 58 |
+
|
| 59 |
+
Interprétation :
|
| 60 |
+
→ Demande analysée avec logique basique
|
| 61 |
+
|
| 62 |
+
Réponse :
|
| 63 |
+
→ Approche recommandée : clarifier l’objectif et structurer la réponse
|
| 64 |
+
"""
|
| 65 |
+
|
| 66 |
+
# --- INTERFACE ---
|
| 67 |
with gr.Blocks() as demo:
|
| 68 |
gr.Markdown("# 🧠 SYNAPTIS")
|
| 69 |
+
gr.Markdown("Agent IA - Analyse, stratégie, idées")
|
| 70 |
+
|
| 71 |
inp = gr.Textbox(label="Ta demande")
|
| 72 |
+
out = gr.Textbox(label="Réponse", lines=10)
|
| 73 |
+
|
| 74 |
btn = gr.Button("Analyser")
|
| 75 |
btn.click(fn=synaptis, inputs=inp, outputs=out)
|
| 76 |
|