File size: 1,179 Bytes
3d7c786
d0e28a6
3d7c786
44cb802
 
 
 
 
 
 
 
a98aff0
3d7c786
44cb802
d0e28a6
3d7c786
44cb802
3d7c786
47a68c5
 
 
 
 
 
 
 
 
44cb802
d0e28a6
5cf785f
d0e28a6
0cec39d
44cb802
 
 
0cec39d
 
44cb802
d0e28a6
 
3d7c786
 
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
38
39
40
41
42
43
import streamlit as st  #Web App
from main import classify

demo_phrases = """ Here are some examples:
this is a phrase
is it neutral
nothing else to say
man I'm so damn angry
sarcasm lol
I love this product
"""

#title
st.title("Sentiment Analysis")

#subtitle
st.markdown("## A selection of popular sentiment analysis models -  hosted on 🤗 Spaces")

model_name = st.selectbox(
    'Select a pre-trained model',
    [
        'finiteautomata/bertweet-base-sentiment-analysis',
        'ahmedrachid/FinancialBERT-Sentiment-Analysis',
        'finiteautomata/beto-sentiment-analysis'
    ],
)

input_sentences = st.text_area("Sentences", value=demo_phrases, height=200)

data = input_sentences.split('\n')

if st.button("Classify"):
    st.write("Please allow a few minutes for the model to run/download")
    for i in range(len(data)):
        j = classify(model_name.strip(), data[i])[0]
        sentiment = j['label']
        confidence = j['score']
        st.write(f"{i}. {data[i]} :: Classification - {sentiment} with confidence {confidence}")
 

st.markdown("Link to the app - [image-to-text-app on 🤗 Spaces](https://huggingface.co/spaces/Amrrs/image-to-text-app)")