Spaces:
Runtime error
Runtime error
Delete app.py
Browse files
app.py
DELETED
|
@@ -1,43 +0,0 @@
|
|
| 1 |
-
import streamlit as st
|
| 2 |
-
from transformers import pipeline
|
| 3 |
-
|
| 4 |
-
access = "hf_"
|
| 5 |
-
token = "hhbFNpjKohezoexWMlyPUpvJQLWlaFhJaa"
|
| 6 |
-
|
| 7 |
-
# Load the text classification model pipeline
|
| 8 |
-
analysis = pipeline("text-classification", model='ZephyruSalsify/FinNews_SentimentAnalysis_v3')
|
| 9 |
-
classification = pipeline("text-classification", model="nickmuchi/finbert-tone-finetuned-finance-topic-classification", token=access+token)
|
| 10 |
-
|
| 11 |
-
st.set_page_config(page_title="Financial News Analysis", page_icon="♕")
|
| 12 |
-
|
| 13 |
-
# Streamlit application layout
|
| 14 |
-
st.title("Financial News Analysis")
|
| 15 |
-
st.write("Analyze corresponding Topic and Trend for Financial News!")
|
| 16 |
-
st.image("./Fin.jpg", use_column_width = True)
|
| 17 |
-
|
| 18 |
-
# Text input for user to enter the text
|
| 19 |
-
text = st.text_area("Enter the Financial News", "")
|
| 20 |
-
|
| 21 |
-
# Perform text classification when the user clicks the "Classify" button
|
| 22 |
-
if st.button("Analyze"):
|
| 23 |
-
|
| 24 |
-
label_1 = ""
|
| 25 |
-
score_1 = 0.0
|
| 26 |
-
label_2 = ""
|
| 27 |
-
score_2 = 0.0
|
| 28 |
-
|
| 29 |
-
# Perform text analysis on the input text
|
| 30 |
-
results_1 = analysis(text)[0]
|
| 31 |
-
results_2 = classification(text)[0]
|
| 32 |
-
|
| 33 |
-
label_1 = results_1["label"]
|
| 34 |
-
score_1 = results_1["score"]
|
| 35 |
-
label_2 = results_2["label"]
|
| 36 |
-
score_2 = results_2["score"]
|
| 37 |
-
|
| 38 |
-
st.write("Financial Text:", text)
|
| 39 |
-
st.write("Trend:", label_1)
|
| 40 |
-
st.write("Trend_Score:", score_1)
|
| 41 |
-
|
| 42 |
-
st.write("Finance Topic:", label_2)
|
| 43 |
-
st.write("Topic_Score:", score_2)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|