Spaces:
Build error
Build error
import streamlit as st | |
from transformers import pipeline | |
sentiment_model = pipeline("text-classification", model="AhmedTaha012/managersFeedback-V1.0.7") | |
increase_decrease_model = pipeline("text-classification", model="AhmedTaha012/nextQuarter-status-V1.1.9") | |
ner_model = pipeline("token-classification", model="AhmedTaha012/finance-ner-v0.0.8-finetuned-ner") | |
st.title("Transcript Analysis") | |
transcript = st.text_area("Enter the transcript:", height=200) | |
if st.button("Analyze"): | |
st.subheader("Sentiment Analysis") | |
sentiment = sentiment_model(transcript)[0]['label'] | |
sentiment_color = "green" if sentiment == "POSITIVE" else "red" | |
st.markdown(f'<span style="color:{sentiment_color}">{sentiment}</span>', unsafe_allow_html=True) | |
st.subheader("Increase/Decrease Prediction") | |
increase_decrease = increase_decrease_model(transcript)[0]['label'] | |
increase_decrease_color = "green" if increase_decrease == "INCREASE" else "red" | |
st.markdown(f'<span style="color:{increase_decrease_color}">{increase_decrease}</span>', unsafe_allow_html=True) | |
st.subheader("NER Metrics") | |
ner_result = ner_model(transcript) | |
revenue = next((entity['entity'] for entity in ner_result if entity['entity'] == 'revenue'), None) | |
if revenue: | |
st.write(f"Revenue: {revenue}") | |
else: | |
st.write("Revenue not found.") | |
show_details = st.checkbox("Show Detailed Predictions") | |
if show_details: | |
st.subheader("Detailed Predictions") | |
st.json({ | |
"Sentiment Analysis": sentiment, | |
"Increase/Decrease Prediction": increase_decrease, | |
"NER Metrics": ner_result | |
}) | |