|
import os |
|
import streamlit as st |
|
|
|
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 |
|
|
|
st.title('Ares Demo') |
|
|
|
query = st.text_area('Find what you seek:', 'I am planning my 10th anniversary, provide me with a list of places in Boston that is quiet, private and climate-controlled so that we can have a great conversation.') |
|
|
|
if query: |
|
response_text,urls = inference(query) |
|
|
|
st.write('Query Results:') |
|
st.write(response_text) |
|
st.write('Sources:') |
|
st.write(urls) |
|
|
|
|