Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -3,7 +3,7 @@ from SysPrompt import sysPrompt
|
|
3 |
from index_query import get_docs
|
4 |
from ChatResponse import get_completion_from_messages, template
|
5 |
import json
|
6 |
-
|
7 |
def res(prompt, historial):
|
8 |
# Preparar historial
|
9 |
#historial=json.loads(historial)
|
@@ -23,8 +23,6 @@ def res(prompt, historial):
|
|
23 |
|
24 |
return respuesta, historial
|
25 |
|
26 |
-
import gradio as gr
|
27 |
-
|
28 |
def respond(message, chat_history, history):
|
29 |
#print(history,type(history))
|
30 |
response= res(message,history)
|
@@ -32,6 +30,8 @@ def respond(message, chat_history, history):
|
|
32 |
chat_history.append((message, bot_message))
|
33 |
return "", chat_history,response[1]
|
34 |
|
|
|
|
|
35 |
|
36 |
botImg='https://lagunaai-my.sharepoint.com/personal/juanariasv_lagunaai_onmicrosoft_com/Documents/output-onlinepngtools.png'
|
37 |
with gr.Blocks() as demo:
|
@@ -54,7 +54,8 @@ with gr.Blocks() as demo:
|
|
54 |
#history_button = gr.Button("Show history")
|
55 |
btn.click(respond, inputs=[msg, chatbot,history], outputs=[msg, chatbot,history])
|
56 |
msg.submit(respond, inputs=[msg, chatbot,history], outputs=[msg, chatbot,history]) #Press enter to submit
|
|
|
57 |
#history_box = gr.Textbox()
|
58 |
#history_button.click(history, inputs=chatbot, outputs=history_box)
|
59 |
gr.close_all()
|
60 |
-
demo.launch()
|
|
|
3 |
from index_query import get_docs
|
4 |
from ChatResponse import get_completion_from_messages, template
|
5 |
import json
|
6 |
+
|
7 |
def res(prompt, historial):
|
8 |
# Preparar historial
|
9 |
#historial=json.loads(historial)
|
|
|
23 |
|
24 |
return respuesta, historial
|
25 |
|
|
|
|
|
26 |
def respond(message, chat_history, history):
|
27 |
#print(history,type(history))
|
28 |
response= res(message,history)
|
|
|
30 |
chat_history.append((message, bot_message))
|
31 |
return "", chat_history,response[1]
|
32 |
|
33 |
+
def WA(history):
|
34 |
+
sendWA("573138614084",history)
|
35 |
|
36 |
botImg='https://lagunaai-my.sharepoint.com/personal/juanariasv_lagunaai_onmicrosoft_com/Documents/output-onlinepngtools.png'
|
37 |
with gr.Blocks() as demo:
|
|
|
54 |
#history_button = gr.Button("Show history")
|
55 |
btn.click(respond, inputs=[msg, chatbot,history], outputs=[msg, chatbot,history])
|
56 |
msg.submit(respond, inputs=[msg, chatbot,history], outputs=[msg, chatbot,history]) #Press enter to submit
|
57 |
+
pedido.click(WA, inputs=history)
|
58 |
#history_box = gr.Textbox()
|
59 |
#history_button.click(history, inputs=chatbot, outputs=history_box)
|
60 |
gr.close_all()
|
61 |
+
demo.launch()
|