testOrca2 / app.py
mmerlange's picture
restore standard
3a1500e
raw
history blame
786 Bytes
import streamlit as st
import requests
import os
import json
SECRET_TOKEN = os.getenv("SECRET_TOKEN")
API_URL = "https://api-inference.huggingface.co/models/microsoft/Orca-2-13b"
headers = {"Authorization": "Bearer "+SECRET_TOKEN}
def query(input:str):
payload = {
"inputs": input
}
response = requests.post(API_URL, headers=headers, json=payload)
return response.json()
def main():
# Streamlit app title
st.title("Test orca2")
# Text input
user_input = st.text_area("Enter your question")
# Chat button
if st.button("Chat"):
# Perform sentiment analysis
response = query(user_input)
print(response)
# Display result
st.write(json.dumps(response))
if __name__ == "__main__":
main()