File size: 885 Bytes
c2ee5cd 7c3e247 fb027f7 7c3e247 031ad03 d88692e c2ee5cd |
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 |
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 are 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)
|