Spaces:
Runtime error
Runtime error
DanyaalMajid
commited on
Commit
·
a527847
1
Parent(s):
5c7cb49
Update app.py
Browse files
app.py
CHANGED
@@ -39,19 +39,23 @@ def main():
|
|
39 |
if analysis_type == "Sentiment Analysis":
|
40 |
st.subheader("Sentiment Analysis:")
|
41 |
|
42 |
-
# Parse JSON data
|
43 |
-
data = distilled_sentiment_classifier(user_text)
|
44 |
-
|
45 |
-
# Extract and display label and score values
|
46 |
for labels_and_scores in data:
|
47 |
for entry in labels_and_scores:
|
48 |
label = entry["label"]
|
49 |
score = entry["score"]
|
50 |
st.write(f"Label: {label}, Score: {score}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
|
56 |
# Parse JSON data
|
57 |
data = emotion_text_classifier(user_text)
|
|
|
39 |
if analysis_type == "Sentiment Analysis":
|
40 |
st.subheader("Sentiment Analysis:")
|
41 |
|
|
|
|
|
|
|
|
|
42 |
for labels_and_scores in data:
|
43 |
for entry in labels_and_scores:
|
44 |
label = entry["label"]
|
45 |
score = entry["score"]
|
46 |
st.write(f"Label: {label}, Score: {score}")
|
47 |
+
|
48 |
+
# Find the label with the highest score
|
49 |
+
max_score_entry = max(data, key=lambda x: x['score'])
|
50 |
+
max_score_label = max_score_entry['label']
|
51 |
+
max_score = max_score_entry['score']
|
52 |
+
|
53 |
+
# Display the label with the highest score
|
54 |
+
st.write(f"Label with the highest score: {max_score_label}, Highest Score: {max_score}")
|
55 |
|
56 |
+
|
57 |
+
if analysis_type == "Emotion Analysis":
|
58 |
+
st.subheader("Emotion Analysis:")
|
59 |
|
60 |
# Parse JSON data
|
61 |
data = emotion_text_classifier(user_text)
|