Taylor / app.py
TRaw's picture
Update app.py
14698eb
import streamlit as st
import requests
API_URL = "https://api-inference.huggingface.co/models/TaylorAI/gte-tiny"
headers = {"Authorization": "Bearer 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"}
def query(payload):
response = requests.post(API_URL, headers=headers, json=payload)
return response.json()
st.title("GTE Chat App")
# Create a text input for the user to enter their message
message = st.text_input("Enter your message:")
# Create a button to trigger the chatbot response
button = st.button("Send")
# When the button is clicked, call the query function with the user's message as the payload
if button:
output = query({
"inputs": {
"source_sentence": message,
"sentences": [
"That is a happy dog",
"That is a very happy person",
"Today is a sunny day"
]
},
})
# Print the chatbot's response
st.write(output)
# Create a text input for the chatbot's response
chatbot_response = st.text_input("Chatbot's response:")
# When the user enters a response, call the query function again with the user's response as the payload
if chatbot_response:
output = query({
"inputs": {
"source_sentence": chatbot_response,
"sentences": [
"That is a happy dog",
"That is a very happy person",
"Today is a sunny day"
]
},
})
# Print the chatbot's response
st.write(output)