|
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") |
|
|
|
|
|
message = st.text_input("Enter your message:") |
|
|
|
|
|
button = st.button("Send") |
|
|
|
|
|
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" |
|
] |
|
}, |
|
}) |
|
|
|
|
|
st.write(output) |
|
|
|
|
|
chatbot_response = st.text_input("Chatbot's response:") |
|
|
|
|
|
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" |
|
] |
|
}, |
|
}) |
|
|
|
|
|
st.write(output) |
|
|