Spaces:
Runtime error
Runtime error
Commit
·
3bf18ee
1
Parent(s):
72f635c
Update app.py
Browse files
app.py
CHANGED
@@ -7,7 +7,7 @@ DEFAULT_OPT = MODEL_OPTS[0]
|
|
7 |
|
8 |
# returns loaded model and tokenizer, if any
|
9 |
def load_model(opt):
|
10 |
-
if opt not in MODEL_OPTS: print("Incorrect model selection. Try again!")
|
11 |
model, tokenizer = None, None
|
12 |
|
13 |
# Load the chosen sentiment analysis model from transformers
|
@@ -45,7 +45,7 @@ dropdown_value = st.selectbox('Select one of the following sentiment analysis mo
|
|
45 |
model, tokenizer = load_model(dropdown_value)
|
46 |
|
47 |
# Perform sentiment analysis on the user's input
|
48 |
-
result = sentiment_analysis(user_text)
|
49 |
|
50 |
# Display the sentiment analysis results
|
51 |
st.write('Sentiment:', result[0]['label'], '; Score:', result[0]['score'])
|
|
|
7 |
|
8 |
# returns loaded model and tokenizer, if any
|
9 |
def load_model(opt):
|
10 |
+
if opt not in MODEL_OPTS: print("Incorrect model selection. Try again!", "I love AI!")
|
11 |
model, tokenizer = None, None
|
12 |
|
13 |
# Load the chosen sentiment analysis model from transformers
|
|
|
45 |
model, tokenizer = load_model(dropdown_value)
|
46 |
|
47 |
# Perform sentiment analysis on the user's input
|
48 |
+
result = sentiment_analysis(model, tokenizer)(user_text)
|
49 |
|
50 |
# Display the sentiment analysis results
|
51 |
st.write('Sentiment:', result[0]['label'], '; Score:', result[0]['score'])
|