File size: 1,151 Bytes
aaaa963
 
a7ec078
aaaa963
 
 
 
 
 
 
a7ec078
aaaa963
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
44
45
46
47
48
49
50
51
52
53
54
55
import streamlit as st
import time
from transformers import pipeline

st.title('Sentiment Analysis')
 
st.subheader("Example: Single statement analysis")
with st.spinner('Wait for it...'):
    time.sleep(5)



classifier = pipeline("sentiment-analysis")
results = classifier("Transformers library is very helpful.")

code = '''
    from transformers import pipeline

    classifier = pipeline("sentiment-analysis")
    results = classifier("Transformers library is very helpful.")
'''
st.code(code, language='python')

st.write("Output:")
st.success(results)

st.divider()

st.subheader("Example: Multiple statements analysis")
with st.spinner('Wait for it...'):
    time.sleep(5)

code = '''
    from transformers import pipeline

    classifier = pipeline("sentiment-analysis")
    results = classifier([
        "This is quick tutorial site.",
        "I learnt new topics today.",
        "I do not like lengthy tutorials."
    ])
'''
st.code(code, language='python')

results = classifier([
    "This is quick tutorial site.",
    "I learnt new topics today.",
    "I do not like lengthy tutorials."
])

st.write("Output:")
st.success(results)