File size: 934 Bytes
3b9de9f
 
 
 
 
 
 
fa12a20
3b9de9f
 
 
 
 
 
 
 
 
 
 
 
 
 
8c59883
 
 
 
 
 
 
 
 
0d925cd
8c59883
 
 
 
 
 
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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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()