CosmoAI commited on
Commit
310bca6
·
1 Parent(s): edc82e3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -8
app.py CHANGED
@@ -30,12 +30,21 @@ def bardChat(data):
30
  # print(answer)
31
  return answer
32
 
33
- # def responsenew(data):
34
- # return bardChat(data)
35
 
36
- gradio_interface = gradio.Interface(
37
- fn = bardChat,
38
- inputs = "text",
39
- outputs = "text"
40
- )
41
- gradio_interface.launch()
 
 
 
 
 
 
 
 
 
 
30
  # print(answer)
31
  return answer
32
 
33
+ def responsenew(data):
34
+ return bardChat(data)
35
 
36
+ with gr.Blocks() as demo:
37
+ chatbot = gr.Chatbot()
38
+ msg = gr.Textbox()
39
+ clear = gr.ClearButton([msg, chatbot])
40
+
41
+ def respond(message, chat_history):
42
+ bot_message = responsenew(message)
43
+ chat_history.append((message, bot_message))
44
+ time.sleep(2)
45
+ return "", chat_history
46
+
47
+ msg.submit(respond, [msg, chatbot], [msg, chatbot])
48
+
49
+ if __name__ == "__main__":
50
+ demo.launch()