import gradio as gr import requests def respond(message, property_id: str = "a0de88a24c4e844d86f285d6abbd59d0"): api_url = "https://data-monopolio.dev.dd360.mx/ai-assistant/v1" data = { "query": message, "sessionId": "12345", "numMessages": 1, "userId": "user-01", "property_id": property_id } try: response = requests.post(api_url, json=data) response.raise_for_status() return response.json().get("response", "No response from API.") except requests.RequestException as e: return f"Error: {str(e)}" demo = gr.Interface( fn=respond, inputs=[ gr.Textbox(label="Message", placeholder="Type your message here..."), gr.Textbox(label="Property ID", placeholder="Provide property id...") ], outputs="text", ) if __name__ == "__main__": demo.launch()