Spaces:
Runtime error
Runtime error
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) |