Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,14 +1,12 @@
|
|
| 1 |
-
|
| 2 |
from transformers import pipeline
|
| 3 |
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
user_input=st.text_area('enter text:')
|
| 8 |
|
| 9 |
-
|
| 10 |
-
if user_input:
|
| 11 |
-
result = sentiment_pipeline(user_input)[0]
|
| 12 |
|
| 13 |
-
|
| 14 |
-
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
from transformers import pipeline
|
| 3 |
|
| 4 |
+
@st.cache_resource
|
| 5 |
+
def load_model():
|
| 6 |
+
return pipeline("sentiment-analysis")
|
|
|
|
| 7 |
|
| 8 |
+
classifier = load_model()
|
|
|
|
|
|
|
| 9 |
|
| 10 |
+
text = st.text_input("Enter text")
|
| 11 |
+
if text:
|
| 12 |
+
st.write(classifier(text))
|