Spaces:
Sleeping
Sleeping
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() |