KishanKumar001 commited on
Commit
c4251ad
·
1 Parent(s): 887db57

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +37 -3
app.py CHANGED
@@ -1,3 +1,5 @@
 
 
1
  import requests
2
 
3
  API_URL = "https://api-inference.huggingface.co/models/ahmedrachid/FinancialBERT-Sentiment-Analysis"
@@ -7,6 +9,38 @@ def query(payload):
7
  response = requests.post(API_URL, headers=headers, json=payload)
8
  return response.json()
9
 
10
- output = query({
11
- "inputs": "I like you. I love you",
12
- })
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import tkinter as tk
2
+ from tkinter import scrolledtext
3
  import requests
4
 
5
  API_URL = "https://api-inference.huggingface.co/models/ahmedrachid/FinancialBERT-Sentiment-Analysis"
 
9
  response = requests.post(API_URL, headers=headers, json=payload)
10
  return response.json()
11
 
12
+ # output = query({
13
+ # "inputs": "I like you. I love you",
14
+ # })
15
+
16
+
17
+ def get_user_input():
18
+ user_query = user_input.get("1.0", tk.END).strip()
19
+ output_text.delete(1.0, tk.END) # Clear previous output
20
+ output = query({"inputs": user_query})
21
+ output_text.insert(tk.END, output)
22
+
23
+
24
+ window = tk.Tk()
25
+ window.title("Query Interface")
26
+
27
+
28
+ user_input_label = tk.Label(window, text="Enter your query:")
29
+ user_input_label.pack()
30
+
31
+ user_input = scrolledtext.ScrolledText(window, width=40, height=5, wrap=tk.WORD)
32
+ user_input.pack()
33
+
34
+
35
+ query_button = tk.Button(window, text="Query", command=get_user_input)
36
+ query_button.pack()
37
+
38
+
39
+ output_text_label = tk.Label(window, text="Output:")
40
+ output_text_label.pack()
41
+
42
+ output_text = scrolledtext.ScrolledText(window, width=40, height=10, wrap=tk.WORD)
43
+ output_text.pack()
44
+
45
+
46
+ window.mainloop()