|
import streamlit as st |
|
from transformers import pipeline |
|
|
|
access = "hf_" |
|
token = "hhbFNpjKohezoexWMlyPUpvJQLWlaFhJaa" |
|
|
|
def main(): |
|
|
|
analysis = pipeline("text-classification", model='ZephyruSalsify/FinNews_SentimentAnalysis') |
|
classification = pipeline("text-classification", model="nickmuchi/finbert-tone-finetuned-finance-topic-classification", token=access+token) |
|
|
|
st.set_page_config(page_title="Financial News Analysis", page_icon="β") |
|
|
|
|
|
st.title("Financial News Analysis") |
|
st.write("Analyze corresponding Topic and Trend for Financial News!") |
|
st.image("./Fin.jpg", use_column_width = True) |
|
|
|
|
|
text = st.text_area("Enter the Financial News", "") |
|
|
|
|
|
if st.button("Analyze"): |
|
|
|
label_1 = "" |
|
score_1 = 0.0 |
|
label_2 = "" |
|
score_2 = 0.0 |
|
|
|
|
|
results_1 = analysis(text)[0] |
|
results_2 = classification(text)[0] |
|
|
|
label_1 = results_1["label"] |
|
score_1 = results_1["score"] |
|
label_2 = results_2["label"] |
|
score_2 = results_2["score"] |
|
|
|
st.write("Financial Text:", text) |
|
st.write("Trend:", label_1) |
|
st.write("Trend_Score:", score_1) |
|
|
|
st.write("Finance Topic:", label_2) |
|
st.write("Topic_Score:", score_2) |
|
|
|
if__name__=="__main__": |
|
main() |