Commit
·
df6e5ca
1
Parent(s):
8d7bee4
Update app.py
Browse files
app.py
CHANGED
@@ -19,68 +19,6 @@ user_query = st.text_area("Enter your text:")
|
|
19 |
if st.button("Analyze Sentiment"):
|
20 |
output = query({"inputs": user_query})
|
21 |
st.text("Sentiment Analysis Output:")
|
22 |
-
st.text(output)
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
# import tkinter as tk
|
38 |
-
# from tkinter import scrolledtext
|
39 |
-
# import requests
|
40 |
-
# import os
|
41 |
-
# SECRET_TOKEN = os.getenv("SECRET_TOKEN")
|
42 |
-
|
43 |
-
# API_URL = "https://api-inference.huggingface.co/models/ahmedrachid/FinancialBERT-Sentiment-Analysis"
|
44 |
-
# headers = {"Authorization": "Bearer {SECRET_TOKEN}"}
|
45 |
-
|
46 |
-
# def query(payload):
|
47 |
-
# response = requests.post(API_URL, headers=headers, json=payload)
|
48 |
-
# return response.json()
|
49 |
-
|
50 |
-
# # output = query({
|
51 |
-
# # "inputs": "I like you. I love you",
|
52 |
-
# # })
|
53 |
-
|
54 |
-
|
55 |
-
# def get_user_input():
|
56 |
-
# user_query = user_input.get("1.0", tk.END).strip()
|
57 |
-
# output_text.delete(1.0, tk.END) # Clear previous output
|
58 |
-
# output = query({"inputs": user_query})
|
59 |
-
# output_text.insert(tk.END, output)
|
60 |
-
|
61 |
-
|
62 |
-
# window = tk.Tk()
|
63 |
-
# window.title("Query Interface")
|
64 |
-
|
65 |
-
|
66 |
-
# user_input_label = tk.Label(window, text="Enter your query:")
|
67 |
-
# user_input_label.pack()
|
68 |
-
|
69 |
-
# user_input = scrolledtext.ScrolledText(window, width=40, height=5, wrap=tk.WORD)
|
70 |
-
# user_input.pack()
|
71 |
-
|
72 |
-
|
73 |
-
# query_button = tk.Button(window, text="Query", command=get_user_input)
|
74 |
-
# query_button.pack()
|
75 |
-
|
76 |
-
|
77 |
-
# output_text_label = tk.Label(window, text="Output:")
|
78 |
-
# output_text_label.pack()
|
79 |
-
|
80 |
-
# output_text = scrolledtext.ScrolledText(window, width=40, height=10, wrap=tk.WORD)
|
81 |
-
# output_text.pack()
|
82 |
-
|
83 |
-
|
84 |
-
# window.mainloop()
|
85 |
|
86 |
|
|
|
19 |
if st.button("Analyze Sentiment"):
|
20 |
output = query({"inputs": user_query})
|
21 |
st.text("Sentiment Analysis Output:")
|
22 |
+
st.text(output[0]['label'])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
|