|
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(): |
|
|
|
st.title("Test orca2") |
|
|
|
|
|
user_input = st.text_area("Enter your question") |
|
|
|
|
|
if st.button("Chat"): |
|
|
|
response = query(user_input) |
|
print(response) |
|
|
|
|
|
st.write(json.dumps(response)) |
|
|
|
if __name__ == "__main__": |
|
main() |
|
|