File size: 624 Bytes
58e4258
 
69d2881
ab5098c
eddc41b
ab5098c
d20a46a
9b07141
 
 
 
 
 
 
 
 
d20a46a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import os
os.system('pip install transformers')
os.system('pip install torch')
import streamlit as st
import transformers

classifier = transformers.pipeline("sentiment-analysis")
txt = st.text_area(
    "Text to analyze",
    "It was the best of times, it was the worst of times, it was the age of "
    "wisdom, it was the age of foolishness, it was the epoch of belief, it "
    "was the epoch of incredulity, it was the season of Light, it was the "
    "season of Darkness, it was the spring of hope, it was the winter of "
    "despair, (...)",
    )

st.write(f'You wrote {len(txt)} characters.\n {classifier(txt)}')