Abhlash commited on
Commit
cc7a125
1 Parent(s): cc6329d
Files changed (1) hide show
  1. app.py +22 -0
app.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from chat import bot # Import the bot function from chat.py
3
+
4
+ def chat_interface(user_message, history):
5
+ history.append((user_message, None)) # Append the user message to history
6
+ response = bot(history) # Get the bot's response
7
+ history[-1] = (user_message, response[-1][1]) # Update the last entry with the bot's response
8
+ return "", history # Return empty string for the input box and updated history
9
+
10
+ # Create the Gradio interface
11
+ iface = gr.Interface(
12
+ fn=chat_interface,
13
+ inputs=["text", "state"],
14
+ outputs=["text", "state"],
15
+ title="BurnerBot",
16
+ description="Chat with me about Burning Man! I can help with event dates, packing lists, principles, and more!",
17
+ theme="soft",
18
+ examples=["When is Burning Man this year?", "What are the 10 principles?", "Can you give me a packing list?"],
19
+ )
20
+
21
+ if __name__ == "__main__":
22
+ iface.launch()