File size: 1,470 Bytes
a2acdb6
 
e89f604
a2acdb6
 
e89f604
a2acdb6
d4ca13d
 
e89f604
 
 
a2acdb6
d4ca13d
 
e89f604
 
8d05dea
 
a2acdb6
d4ca13d
e89f604
 
8d05dea
 
a2acdb6
d4ca13d
e89f604
 
 
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
import streamlit as st
from transformers import pipeline
import math
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.9-finetuned-ner")

st.title("Transcript Analysis")
transcript = st.text_area("Enter the transcript:", height=200)
tokens=transcript.split()
splitSize=256
chunks=[tokens[r*splitSize:(r+1)*splitSize] for r in range(math.ceil(len(tokens)/splitSize))]

if st.button("Analyze"):
    st.subheader("Sentiment Analysis")
    sentiment = [sentiment_model(x)[0]['label'] for x in chunks]
    sentiment=max(sentiment,key=sentiment.count)
    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(x)[0]['label'] for x in chunks]
    increase_decrease=max(increase_decrease,key=increase_decrease.count)
    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(x) for x in chunks]
    st.write(str(ner_result))