Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -13,7 +13,7 @@ sentimentAnalysisModels = {
|
|
| 13 |
sentimentAnalysisLanguageSelections = st.selectbox("Please select one of these finetuned models from the dropdown", list(sentimentAnalysisModels.keys()))
|
| 14 |
|
| 15 |
# roBERTa specific label map
|
| 16 |
-
|
| 17 |
"LABEL_1": "POSITIVE", "LABEL_2": "NEUTRAL"}
|
| 18 |
|
| 19 |
# Load the selected model and tokenizer
|
|
@@ -30,7 +30,7 @@ sentimentAnalysisSubmitButton = st.button("Press the submit button for final gra
|
|
| 30 |
if sentimentAnalysisSubmitButton and sentimentAnalysisTextInput:
|
| 31 |
sentimentAnalysisFinalOutput = sentiment_pipeline(sentimentAnalysisTextInput)
|
| 32 |
if sentimentAnalysisSelectedModels == "roBERTa":
|
| 33 |
-
st.write("Roberta Sentiment Analysis Resultant Value:",
|
| 34 |
st.write("Roberta Sentiment Analysis Resultant Score:", sentimentAnalysisFinalOutput[0]["Probability Assigned with Sentiment Analysis Label"])
|
| 35 |
else:
|
| 36 |
st.write("Sentiment Analysis Resultant Value:", sentimentAnalysisFinalOutput[0]["Sentiment Analysis Label"])
|
|
|
|
| 13 |
sentimentAnalysisLanguageSelections = st.selectbox("Please select one of these finetuned models from the dropdown", list(sentimentAnalysisModels.keys()))
|
| 14 |
|
| 15 |
# roBERTa specific label map
|
| 16 |
+
sentimentAnalysisLanguageMap = {"LABEL_0": "NEGATIVE",
|
| 17 |
"LABEL_1": "POSITIVE", "LABEL_2": "NEUTRAL"}
|
| 18 |
|
| 19 |
# Load the selected model and tokenizer
|
|
|
|
| 30 |
if sentimentAnalysisSubmitButton and sentimentAnalysisTextInput:
|
| 31 |
sentimentAnalysisFinalOutput = sentiment_pipeline(sentimentAnalysisTextInput)
|
| 32 |
if sentimentAnalysisSelectedModels == "roBERTa":
|
| 33 |
+
st.write("Roberta Sentiment Analysis Resultant Value:", sentimentAnalysisLanguageMap[sentimentAnalysisFinalOutput[0]["Roberta Label"]])
|
| 34 |
st.write("Roberta Sentiment Analysis Resultant Score:", sentimentAnalysisFinalOutput[0]["Probability Assigned with Sentiment Analysis Label"])
|
| 35 |
else:
|
| 36 |
st.write("Sentiment Analysis Resultant Value:", sentimentAnalysisFinalOutput[0]["Sentiment Analysis Label"])
|