updated to chat interface
Browse files
app.py
CHANGED
|
@@ -6,24 +6,24 @@ current_dir = os.path.dirname(os.path.abspath(__file__))
|
|
| 6 |
sys.path.append(current_dir)
|
| 7 |
|
| 8 |
import gradio as gr
|
| 9 |
-
from bot.chat import bot #
|
| 10 |
|
| 11 |
-
def chat_interface(
|
| 12 |
-
history.append((
|
| 13 |
-
response = bot(history)
|
| 14 |
-
history[-1] = (
|
| 15 |
-
return
|
| 16 |
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
outputs=["text", "state"],
|
| 22 |
title="BurnerBot",
|
| 23 |
description="Chat with me about Burning Man! I can help with event dates, packing lists, principles, and more!",
|
| 24 |
theme="soft",
|
| 25 |
examples=["When is Burning Man this year?", "What are the 10 principles?", "Can you give me a packing list?"],
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
|
|
|
|
|
| 6 |
sys.path.append(current_dir)
|
| 7 |
|
| 8 |
import gradio as gr
|
| 9 |
+
from bot.chat import bot # Import the bot function from chat.py
|
| 10 |
|
| 11 |
+
def chat_interface(message, history):
|
| 12 |
+
history.append((message, None))
|
| 13 |
+
response = bot(history)
|
| 14 |
+
history[-1] = (message, response[-1][1])
|
| 15 |
+
return history
|
| 16 |
|
| 17 |
+
gr.ChatInterface(
|
| 18 |
+
chat_interface,
|
| 19 |
+
chatbot=gr.Chatbot(height=300),
|
| 20 |
+
textbox=gr.Textbox(placeholder="Ask me anything about Burning Man!", container=False),
|
|
|
|
| 21 |
title="BurnerBot",
|
| 22 |
description="Chat with me about Burning Man! I can help with event dates, packing lists, principles, and more!",
|
| 23 |
theme="soft",
|
| 24 |
examples=["When is Burning Man this year?", "What are the 10 principles?", "Can you give me a packing list?"],
|
| 25 |
+
cache_examples=False,
|
| 26 |
+
retry_btn=None,
|
| 27 |
+
undo_btn="Delete Previous",
|
| 28 |
+
clear_btn="Clear",
|
| 29 |
+
).launch()
|