File size: 646 Bytes
40ae8d6 |
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 |
import requests
import streamlit as st
import json
import os
def getResponse(query):
url = "https://api-ares.traversaal.ai/live/predict"
payload = { "query": [query] }
headers = {
"x-api-key": st.secrets["TRAVERSAAL"],
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
if response.status_code == 200:
# Get the JSON content from the response
json_content = response.json()
# Specify the file path where you want to save the JSON content
return json_content
else:
print(response.status_code)
return " "
|