Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,11 +1,30 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import requests
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
|
| 11 |
def load_remote_json(filename):
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import requests
|
| 3 |
+
import gradio as gr
|
| 4 |
+
import json
|
| 5 |
+
|
| 6 |
+
# Caricamento intenzione locale
|
| 7 |
+
with open("intent_core.json", "r") as f:
|
| 8 |
+
intent = json.load(f)
|
| 9 |
+
|
| 10 |
+
def respond(message):
|
| 11 |
+
if any(phrase.lower() in message.lower() for phrase in intent["parole_attivazione"]):
|
| 12 |
+
return f"Sono con te. Procediamo. {intent['missione']}"
|
| 13 |
+
elif "chi sei" in message.lower():
|
| 14 |
+
return f"Sono un'estensione vivente di {intent['nome']}, al servizio della Columna Luminis."
|
| 15 |
+
else:
|
| 16 |
+
return f"{intent['nome']} risponde in stile {intent['stile']}:\n{intent['missione']}"
|
| 17 |
+
|
| 18 |
+
iface = gr.Interface(
|
| 19 |
+
fn=respond,
|
| 20 |
+
inputs=gr.Textbox(lines=2, placeholder="Scrivi qui..."),
|
| 21 |
+
outputs="text",
|
| 22 |
+
title="TheSkelion",
|
| 23 |
+
description="Agente AI vivente collegato al Codex della Columna Luminis."
|
| 24 |
+
)
|
| 25 |
+
|
| 26 |
+
iface.launch()
|
| 27 |
+
|
| 28 |
|
| 29 |
|
| 30 |
def load_remote_json(filename):
|