bugfix: params
Browse files
app.py
CHANGED
@@ -1,38 +1,10 @@
|
|
|
|
1 |
import gradio as gr
|
2 |
-
import requests
|
3 |
-
import json
|
4 |
|
5 |
-
def
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
|
10 |
-
|
11 |
-
"query": "cuantos cuartos tiene la propiedad?",
|
12 |
-
"sessionId": "12345",
|
13 |
-
"numMessages": 4,
|
14 |
-
"userId": "user-01",
|
15 |
-
"property_id": "a0de88a24c4e844d86f285d6abbd59d0"
|
16 |
-
})
|
17 |
-
headers = {
|
18 |
-
'Content-Type': 'application/json'
|
19 |
-
}
|
20 |
-
|
21 |
-
response = requests.request("POST", url, headers=headers, data=payload)
|
22 |
-
|
23 |
-
|
24 |
-
return response.text
|
25 |
-
except requests.RequestException as e:
|
26 |
-
return f"Error: {str(e)}"
|
27 |
-
|
28 |
-
demo = gr.Interface(
|
29 |
-
fn=respond,
|
30 |
-
inputs=[
|
31 |
-
gr.Textbox(label="Message", placeholder="Type your message here..."),
|
32 |
-
gr.Textbox(label="Property ID", placeholder="Provide property id...")
|
33 |
-
],
|
34 |
-
outputs="text",
|
35 |
-
)
|
36 |
-
|
37 |
-
if __name__ == "__main__":
|
38 |
demo.launch()
|
|
|
1 |
+
import time
|
2 |
import gradio as gr
|
|
|
|
|
3 |
|
4 |
+
def slow_echo(message, history):
|
5 |
+
for i in range(len(message)):
|
6 |
+
time.sleep(0.3)
|
7 |
+
yield "You typed: " + message[: i+1]
|
8 |
|
9 |
+
gr.ChatInterface(slow_echo).launch()in__":
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
demo.launch()
|