traversaal-ai
commited on
Commit
•
c2ee5cd
1
Parent(s):
4c8632e
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import streamlit as st
|
3 |
+
|
4 |
+
import requests
|
5 |
+
ares_api = os.getenv("ARES_API")
|
6 |
+
|
7 |
+
|
8 |
+
url = "https://api-ares.traversaal.ai/live/predict"
|
9 |
+
headers = {
|
10 |
+
"x-api-key": ares_api,
|
11 |
+
"content-type": "application/json"
|
12 |
+
}
|
13 |
+
|
14 |
+
st.title('Ares Demo')
|
15 |
+
|
16 |
+
st.text_input(label, value="", max_chars=None, key=None, type="default", help=None, autocomplete=None, on_change=None, args=None, kwargs=None, *, placeholder=None, disabled=False, label_visibility="visible")
|
17 |
+
|
18 |
+
def inference(query):
|
19 |
+
payload = { "query": [query] }
|
20 |
+
response = requests.post(url, json=payload, headers=headers)
|
21 |
+
response_text=response.json().get('data').get('response_text')
|
22 |
+
urls=response.json().get('data').get('web_url')
|
23 |
+
return response_text, urls
|
24 |
+
|
25 |
+
|