hash-map commited on
Commit
7cc3b21
·
verified ·
1 Parent(s): 7409ee4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -1,23 +1,23 @@
1
  import gradio as gr
2
  from rag import respond_rag_huggingface as response_hf
3
 
4
- history = []
5
 
6
  def respond(message):
7
- response = response_hf(message)
 
8
  chat_history.append((message, response))
9
  return "", chat_history
10
 
11
  with gr.Blocks() as demo:
12
  gr.Markdown("# Game of Thrones Q&A bot")
13
 
14
- chatbot = gr.Chatbot()
15
- msg = gr.Textbox(label="write something about game of thrones here...")
16
-
17
-
18
 
19
  clear = gr.Button("Clear")
20
 
21
- msg.submit(respond, [msg], [msg, chatbot])
22
  clear.click(lambda: ([], ""), None, [chatbot, msg])
 
23
  demo.launch()
 
1
  import gradio as gr
2
  from rag import respond_rag_huggingface as response_hf
3
 
4
+ chat_history = []
5
 
6
  def respond(message):
7
+ global chat_history
8
+ response = response_hf(message)
9
  chat_history.append((message, response))
10
  return "", chat_history
11
 
12
  with gr.Blocks() as demo:
13
  gr.Markdown("# Game of Thrones Q&A bot")
14
 
15
+ chatbot = gr.Chatbot(label="Chat History")
16
+ msg = gr.Textbox(label="Write something about Game of Thrones here...")
 
 
17
 
18
  clear = gr.Button("Clear")
19
 
20
+ msg.submit(respond, inputs=[msg], outputs=[msg, chatbot])
21
  clear.click(lambda: ([], ""), None, [chatbot, msg])
22
+
23
  demo.launch()