Update app.py
Browse files
app.py
CHANGED
|
@@ -1,23 +1,24 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
from transformers import pipeline
|
| 3 |
|
|
|
|
|
|
|
|
|
|
| 4 |
# Streamlit application title
|
| 5 |
-
st.title("Financial News
|
| 6 |
-
st.write("
|
| 7 |
|
| 8 |
# Load the summarization and sentiment analysis pipelines
|
| 9 |
|
| 10 |
pipe = pipeline("text-classification", model="roselyu/FinSent-XLMR-FinNews")
|
| 11 |
|
| 12 |
-
# User input
|
| 13 |
user_input = st.text_area("Enter a short financial news article:")
|
|
|
|
| 14 |
|
| 15 |
# Summarize and identify sentiment button
|
| 16 |
if st.button("Identify Sentiment"):
|
| 17 |
|
| 18 |
-
# Analyze sentiment
|
| 19 |
-
sentiment_label = pipe(user_input)[0]["label"]
|
| 20 |
-
|
| 21 |
# Display summary and sentiment
|
| 22 |
|
| 23 |
st.write(f"Sentiment: {sentiment_label}")
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
from transformers import pipeline
|
| 3 |
|
| 4 |
+
# inital value of sentiment label
|
| 5 |
+
sentiment_label = 0
|
| 6 |
+
|
| 7 |
# Streamlit application title
|
| 8 |
+
st.title("Financial News Sentiment Analysis")
|
| 9 |
+
st.write("Identify the sentiment to help you make decisions.")
|
| 10 |
|
| 11 |
# Load the summarization and sentiment analysis pipelines
|
| 12 |
|
| 13 |
pipe = pipeline("text-classification", model="roselyu/FinSent-XLMR-FinNews")
|
| 14 |
|
| 15 |
+
# User input and sentiment analysis
|
| 16 |
user_input = st.text_area("Enter a short financial news article:")
|
| 17 |
+
sentiment_label = pipe(user_input)[0]["label"]
|
| 18 |
|
| 19 |
# Summarize and identify sentiment button
|
| 20 |
if st.button("Identify Sentiment"):
|
| 21 |
|
|
|
|
|
|
|
|
|
|
| 22 |
# Display summary and sentiment
|
| 23 |
|
| 24 |
st.write(f"Sentiment: {sentiment_label}")
|