JoanParanoid commited on
Commit
c1e508c
·
verified ·
1 Parent(s): 8e2961e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -20
app.py CHANGED
@@ -4,7 +4,6 @@ from transformers import pipeline
4
  access = "hf_"
5
  token = "hhbFNpjKohezoexWMlyPUpvJQLWlaFhJaa"
6
 
7
-
8
  # Load the text classification model pipeline
9
  analysis = pipeline("text-classification", model='ZephyruSalsify/FinNews_SentimentAnalysis')
10
  classification = pipeline("text-classification", model="nickmuchi/finbert-tone-finetuned-finance-topic-classification", token=access+token)
@@ -34,27 +33,10 @@ if st.button("Analyze"):
34
  label_2 = results_2["label"]
35
  score_2 = results_2["score"]
36
 
37
-
38
- # Perform text classification when the user clicks the "Classify" button
39
- if st.button("Analyze"):
40
-
41
- label_1 = ""
42
- score_1 = 0.0
43
- label_2 = ""
44
- score_2 = 0.0
45
-
46
- # Perform text analysis on the input text
47
- results_1 = analysis(text)[0]
48
- results_2 = classification(text)[0]
49
-
50
- label_1 = results_1["label"]
51
- score_1 = results_1["score"]
52
- label_2 = results_2["label"]
53
- score_2 = results_2["score"]
54
-
55
  st.write("Financial Text:", text)
56
  st.write("Trend:", label_1)
57
  st.write("Trend_Score:", score_1)
58
 
59
  st.write("Finance Topic:", label_2)
60
- st.write("Topic_Score:", score_2)
 
4
  access = "hf_"
5
  token = "hhbFNpjKohezoexWMlyPUpvJQLWlaFhJaa"
6
 
 
7
  # Load the text classification model pipeline
8
  analysis = pipeline("text-classification", model='ZephyruSalsify/FinNews_SentimentAnalysis')
9
  classification = pipeline("text-classification", model="nickmuchi/finbert-tone-finetuned-finance-topic-classification", token=access+token)
 
33
  label_2 = results_2["label"]
34
  score_2 = results_2["score"]
35
 
36
+ # Display the results
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  st.write("Financial Text:", text)
38
  st.write("Trend:", label_1)
39
  st.write("Trend_Score:", score_1)
40
 
41
  st.write("Finance Topic:", label_2)
42
+ st.write("Topic_Score:", score_2)