File size: 575 Bytes
3b9de9f
 
 
 
 
 
 
fa12a20
3b9de9f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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

iface = gr.Interface(fn=inference, inputs="text", outputs=["html","json"])
iface.launch()