Spaces:
Runtime error
Runtime error
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +6 -3
src/streamlit_app.py
CHANGED
|
@@ -2,10 +2,13 @@
|
|
| 2 |
import streamlit as st
|
| 3 |
from transformers import pipeline
|
| 4 |
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
st.title("Sentiment Analysis")
|
| 8 |
rev = st.text_input("Enter a review to analyze its sentiment.")
|
| 9 |
-
|
| 10 |
-
if analyze:
|
| 11 |
st.write(sentiment_analysis(rev)[0]['label'])
|
|
|
|
| 2 |
import streamlit as st
|
| 3 |
from transformers import pipeline
|
| 4 |
|
| 5 |
+
@st.cache_resource
|
| 6 |
+
def load_model():
|
| 7 |
+
return pipeline("sentiment-analysis", model="siebert/sentiment-roberta-large-english")
|
| 8 |
+
|
| 9 |
+
sentiment_analysis = load_model()
|
| 10 |
|
| 11 |
st.title("Sentiment Analysis")
|
| 12 |
rev = st.text_input("Enter a review to analyze its sentiment.")
|
| 13 |
+
if st.button("Analyze") and rev:
|
|
|
|
| 14 |
st.write(sentiment_analysis(rev)[0]['label'])
|