Spaces:
Runtime error
Runtime error
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) | |