Spaces:
Sleeping
Sleeping
nurindahpratiwi commited on
Commit ·
3c12279
1
Parent(s): 207f75d
change model
Browse files
app.py
CHANGED
|
@@ -13,12 +13,13 @@ st.markdown("Link to the app - [sentiment-analysis-streamlit on 🤗 Spaces](htt
|
|
| 13 |
text = st.text_input("Enter text here", "I love you")
|
| 14 |
|
| 15 |
# Model selection dropdown
|
| 16 |
-
model_names = ["distilbert-base-uncased-finetuned-sst-2-english"]
|
|
|
|
| 17 |
model = st.selectbox("Select a pretrained model", model_names)
|
| 18 |
|
| 19 |
# Sentiment analysis function
|
| 20 |
def analyze_sentiment(text, model):
|
| 21 |
-
if model == "
|
| 22 |
classifier = pipeline("sentiment-analysis", model=model)
|
| 23 |
result = classifier(text)[0]
|
| 24 |
sentiment = result['label']
|
|
|
|
| 13 |
text = st.text_input("Enter text here", "I love you")
|
| 14 |
|
| 15 |
# Model selection dropdown
|
| 16 |
+
#model_names = ["distilbert-base-uncased-finetuned-sst-2-english"]
|
| 17 |
+
model_names = ["cardiffnlp/twitter-xlm-roberta-base-sentiment-multilingual"]
|
| 18 |
model = st.selectbox("Select a pretrained model", model_names)
|
| 19 |
|
| 20 |
# Sentiment analysis function
|
| 21 |
def analyze_sentiment(text, model):
|
| 22 |
+
if model == "cardiffnlp/twitter-xlm-roberta-base-sentiment-multilingual":
|
| 23 |
classifier = pipeline("sentiment-analysis", model=model)
|
| 24 |
result = classifier(text)[0]
|
| 25 |
sentiment = result['label']
|