Spaces:
Sleeping
Sleeping
import os | |
import streamlit as st | |
import requests | |
api_key = os.getenv("ares_5e61d51f3abc8feb37710d8784fa49e11426ee25d7ec5236b80362832f306ed2") | |
url = "https://api-ares.traversaal.ai/live/predict" | |
headers = { | |
"x-api-key": api_key, | |
"content-type": "application/json" | |
} | |
def inference(query): | |
payload = { "query": [query] } | |
response = requests.post(url, json=payload, headers=headers) | |
st.error(response) | |
response_text=response.json().get('data').get('response_text') | |
urls=response.json().get('data').get('web_url') | |
return response_text, urls | |
st.title('Ares Demo') | |
query = st.text_input('Enter a query', value='') | |
if query: | |
response_text,urls = inference(query) | |
st.write('Query Results:') | |
st.write(response_text) | |
st.write('Sources:') | |
st.write(urls) |