Update app.py
Browse files
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 |
-
|
33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
clear = gr.Button("Clear")
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
|
40 |
-
|
41 |
-
|
|
|
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)
|