TRaw commited on
Commit
853b568
1 Parent(s): 61a8c2a

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -0
app.py ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import requests
3
+
4
+ API_URL = "https://api-inference.huggingface.co/models/TaylorAI/gte-tiny"
5
+ headers = {"Authorization": "Bearer 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"}
6
+
7
+ def query(payload):
8
+ response = requests.post(API_URL, headers=headers, json=payload)
9
+ return response.json()
10
+
11
+ st.title("GTE Chat App")
12
+
13
+ # Create a text input for the user to enter their message
14
+ message = st.text_input("Enter your message:")
15
+
16
+ # Create a button to trigger the chatbot response
17
+ button = st.button("Send")
18
+
19
+ # When the button is clicked, call the query function with the user's message as the payload
20
+ if button:
21
+ output = query({
22
+ "inputs": {
23
+ "source_sentence": message,
24
+ "sentences": [
25
+ "That is a happy dog",
26
+ "That is a very happy person",
27
+ "Today is a sunny day"
28
+ ]
29
+ },
30
+ })
31
+
32
+ # Print the chatbot's response
33
+ st.write(output)