File size: 1,650 Bytes
a2acdb6
 
 
 
 
 
d4ca13d
 
a2acdb6
d4ca13d
 
 
8d05dea
 
a2acdb6
d4ca13d
 
8d05dea
 
a2acdb6
d4ca13d
 
 
 
 
 
 
8d05dea
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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
        })