DaniRIU commited on
Commit
e2130ba
·
1 Parent(s): ddd57a7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -9
app.py CHANGED
@@ -29,15 +29,24 @@ def ask_api(api_key, question): #Falta el argumento api KEY
29
  return text
30
 
31
  with gr.Blocks() as demo:
32
- chatbot = gr.Chatbot()
33
- msg = gr.Textbox()
 
 
 
 
 
 
 
 
34
  clear = gr.Button("Clear")
35
- def respond(message, chat_history):
36
- bot_message = ask_api(API_KEY,message)
37
- chat_history.append((message, bot_message))
38
- return "", chat_history
39
 
40
- msg.submit(respond, [msg, chatbot], [msg, chatbot])
41
- clear.click(lambda: None, None, chatbot, queue=False)
 
42
 
43
- demo.launch()
 
29
  return text
30
 
31
  with gr.Blocks() as demo:
32
+ gr.Markdown(
33
+ """
34
+ # Riu Hotels Chat
35
+ Comience a escribir a continuación para ver el resultado.
36
+ """)
37
+
38
+ chatbot = gr.Chatbot()
39
+ msg = gr.Textbox()
40
+ with gr.Row():
41
+ btn = gr.Button(value="Submit")
42
  clear = gr.Button("Clear")
43
+ def respond(message, chat_history):
44
+ bot_message = ask_api(API_KEY,message)
45
+ chat_history.append((message, bot_message))
46
+ return "", chat_history
47
 
48
+ msg.submit(respond, [msg, chatbot], [msg, chatbot])
49
+ btn.click(respond, [msg, chatbot], [msg, chatbot])
50
+ clear.click(lambda: None, None, chatbot, queue=False)
51
 
52
+ demo.launch(debug=True)