ares-demo / app.py
traversaal-ai's picture
Create app.py
3b9de9f verified
raw
history blame
524 Bytes
import gradio as gr
import os
import requests
ares_api = os.getenv("ARES_API")
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
iface = gr.Interface(fn=inference, inputs="text", outputs=["html","json"])
iface.launch()