traversaal-ai commited on
Commit
3b9de9f
1 Parent(s): 553ad17

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -0
app.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import os
3
+
4
+ import requests
5
+ ares_api = os.getenv("ARES_API")
6
+
7
+
8
+
9
+ headers = {
10
+ "x-api-key": ares_api,
11
+ "content-type": "application/json"
12
+ }
13
+
14
+
15
+
16
+ def inference(query):
17
+ payload = { "query": [query] }
18
+ response = requests.post(url, json=payload, headers=headers)
19
+ response_text=response.json().get('data').get('response_text')
20
+ urls=response.json().get('data').get('web_url')
21
+ return response_text, urls
22
+
23
+ iface = gr.Interface(fn=inference, inputs="text", outputs=["html","json"])
24
+ iface.launch()