refactor: attribute
Browse files
app.py
CHANGED
@@ -3,12 +3,12 @@ import gradio as gr
|
|
3 |
import requests
|
4 |
import json
|
5 |
|
6 |
-
def slow_api_response(message, history, property_id="c0ced2220b87fc23762facf617157a4f"):
|
7 |
url = "https://data-monopolio.dev.dd360.mx/ai-assistant/v1"
|
8 |
|
9 |
payload = json.dumps({
|
10 |
"query": message,
|
11 |
-
"sessionId":
|
12 |
"numMessages": "3",
|
13 |
"userId": "user-01",
|
14 |
"property_id": property_id #"c0ced2220b87fc23762facf617157a4f"
|
@@ -35,18 +35,25 @@ def slow_api_response(message, history, property_id="c0ced2220b87fc23762facf6171
|
|
35 |
except requests.RequestException as e:
|
36 |
yield f"Error: {str(e)}"
|
37 |
|
38 |
-
property_id_input = gr.Textbox(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
examples = [
|
40 |
-
["hola", "c0ced2220b87fc23762facf617157a4f"],
|
41 |
-
["me gustaria mas informacion de la casa en venta", "c0ced2220b87fc23762facf617157a4f"],
|
42 |
-
["acepta mascotas?", "c0ced2220b87fc23762facf617157a4f"]
|
43 |
]
|
44 |
|
45 |
demo = gr.ChatInterface(fn=slow_api_response,
|
46 |
title="AI Assistant",
|
47 |
-
additional_inputs=[property_id_input],
|
48 |
description="Esta app simula una conversación con un asistente virtual que conoce una propiedad.",
|
49 |
examples=examples
|
50 |
-
).launch()
|
51 |
-
|
52 |
-
|
|
|
3 |
import requests
|
4 |
import json
|
5 |
|
6 |
+
def slow_api_response(message, history, property_id="c0ced2220b87fc23762facf617157a4f", session_id="12345"):
|
7 |
url = "https://data-monopolio.dev.dd360.mx/ai-assistant/v1"
|
8 |
|
9 |
payload = json.dumps({
|
10 |
"query": message,
|
11 |
+
"sessionId": session_id,
|
12 |
"numMessages": "3",
|
13 |
"userId": "user-01",
|
14 |
"property_id": property_id #"c0ced2220b87fc23762facf617157a4f"
|
|
|
35 |
except requests.RequestException as e:
|
36 |
yield f"Error: {str(e)}"
|
37 |
|
38 |
+
property_id_input = gr.Textbox(
|
39 |
+
label="Property ID",
|
40 |
+
placeholder="Ingresa el ID de la propiedad"
|
41 |
+
)
|
42 |
+
|
43 |
+
session_id_input = gr.Textbox(
|
44 |
+
label="Session ID",
|
45 |
+
placeholder="Ingresa el ID de tu sesion"
|
46 |
+
)
|
47 |
+
|
48 |
examples = [
|
49 |
+
["hola", "c0ced2220b87fc23762facf617157a4f", "12345"],
|
50 |
+
["me gustaria mas informacion de la casa en venta", "c0ced2220b87fc23762facf617157a4f", "12345"],
|
51 |
+
["acepta mascotas?", "c0ced2220b87fc23762facf617157a4f", "12345"]
|
52 |
]
|
53 |
|
54 |
demo = gr.ChatInterface(fn=slow_api_response,
|
55 |
title="AI Assistant",
|
56 |
+
additional_inputs=[property_id_input, session_id_input],
|
57 |
description="Esta app simula una conversación con un asistente virtual que conoce una propiedad.",
|
58 |
examples=examples
|
59 |
+
).launch()
|
|
|
|