File size: 943 Bytes
853b568
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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)