Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| import os | |
| import requests | |
| ares_api = os.getenv("ARES_API") | |
| url = "https://api-ares.traversaal.ai/live/predict" | |
| headers = { | |
| "x-api-key": ares_api, | |
| "content-type": "application/json" | |
| } | |
| def inference(query): | |
| payload = { "query": [query] } | |
| response = requests.post(url, json=payload, headers=headers) | |
| response_text=response.json().get('data').get('response_text') | |
| urls=response.json().get('data').get('web_url') | |
| return response_text, urls | |
| demo_questions = [ | |
| "best hotels in Central London", | |
| "taco spots in San Francisco", | |
| "best hiking shoes with arch support", | |
| "different techniques for Quantizations of LLMs" | |
| ] | |
| iface = gr.Interface( | |
| fn=inference, | |
| inputs="text", | |
| #examples=demo_questions, | |
| #outputs=["text","json","json","text"], | |
| outputs=[gr.Markdown(),gr.components.JSON( label="sources")], | |
| title="ares-api-demo", | |
| description="Enter a query" | |
| ) | |
| iface.launch() |