Spaces:
Sleeping
Sleeping
danielecelsa
commited on
Commit
·
50cc36f
1
Parent(s):
7b7d3f1
update info window
Browse files
app.py
CHANGED
|
@@ -131,13 +131,27 @@ def chat_fn(message, history):
|
|
| 131 |
{"input": message},
|
| 132 |
config={"configurable": {"session_id": session_id}}
|
| 133 |
)
|
| 134 |
-
return result["output"]
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 141 |
|
| 142 |
if __name__ == "__main__":
|
| 143 |
-
|
|
|
|
| 131 |
{"input": message},
|
| 132 |
config={"configurable": {"session_id": session_id}}
|
| 133 |
)
|
| 134 |
+
#return result["output"]
|
| 135 |
+
# history è una lista di tuple [(user, bot), ...], quindi ritorna nuova risposta e aggiorna la storia
|
| 136 |
+
return result["output"], history + [(message, result["output"])]
|
| 137 |
+
|
| 138 |
+
with gr.Blocks() as demo:
|
| 139 |
+
gr.Markdown(
|
| 140 |
+
"""
|
| 141 |
+
# DaniBot 🤖
|
| 142 |
+
|
| 143 |
+
Questo chatbot può rispondere sui drinks di Dani, ma anche a domande di matematica, informazioni sulle squadre di calcio italiane,
|
| 144 |
+
il meteo, e altro ancora. Usa dei tools integrati per darti risposte più accurate.
|
| 145 |
+
|
| 146 |
+
Scrivi un messaggio per iniziare la chat!
|
| 147 |
+
Scrivi 'q' o 'quit' per terminare la chat!
|
| 148 |
+
"""
|
| 149 |
+
)
|
| 150 |
+
chatbot = gr.ChatInterface(
|
| 151 |
+
fn=chat_fn,
|
| 152 |
+
examples=["Quando è stata fondata la Juventus?"],
|
| 153 |
+
title="DaniBot - ask me something!"
|
| 154 |
+
)
|
| 155 |
|
| 156 |
if __name__ == "__main__":
|
| 157 |
+
demo.launch()
|