Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -65,14 +65,16 @@ def analyze_text(icelandic_text):
|
|
65 |
# Perform initial analysis to get scores
|
66 |
sentiment_result = sentiment_classifier(icelandic_text)[0]
|
67 |
formality_result = formality_classifier(icelandic_text)[0]
|
68 |
-
|
|
|
|
|
69 |
politeness_result = politeness_classifier(translated_text)[0]
|
70 |
|
71 |
# Gather scores and labels
|
72 |
scores_labels = {
|
73 |
"Sentiment": (sentiment_result['score'], sentiment_bench),
|
74 |
"Formality": (formality_result['score'], formality_bench),
|
75 |
-
"Toxicity": (
|
76 |
"Politeness": (politeness_result['score'], politeness_bench)
|
77 |
}
|
78 |
|
@@ -89,6 +91,7 @@ def analyze_text(icelandic_text):
|
|
89 |
"""
|
90 |
return analysis_results.strip()
|
91 |
|
|
|
92 |
demo = gr.Interface(fn=analyze_text,
|
93 |
inputs=gr.Textbox(lines=2, placeholder="Enter Icelandic Text Here..."),
|
94 |
outputs=gr.Textbox(label="Analysis Results"),
|
|
|
65 |
# Perform initial analysis to get scores
|
66 |
sentiment_result = sentiment_classifier(icelandic_text)[0]
|
67 |
formality_result = formality_classifier(icelandic_text)[0]
|
68 |
+
# Assuming detoxify_classifier gives a list of dictionaries, we need to adjust how we process this
|
69 |
+
# For the sake of example, let's just mock a toxicity score here. Adjust this based on actual model output
|
70 |
+
toxicity_mock_score = 0.5 # Placeholder, replace with actual processing of detoxify_classifier output
|
71 |
politeness_result = politeness_classifier(translated_text)[0]
|
72 |
|
73 |
# Gather scores and labels
|
74 |
scores_labels = {
|
75 |
"Sentiment": (sentiment_result['score'], sentiment_bench),
|
76 |
"Formality": (formality_result['score'], formality_bench),
|
77 |
+
"Toxicity": (toxicity_mock_score, toxicity_bench), # Use the mock or processed score
|
78 |
"Politeness": (politeness_result['score'], politeness_bench)
|
79 |
}
|
80 |
|
|
|
91 |
"""
|
92 |
return analysis_results.strip()
|
93 |
|
94 |
+
|
95 |
demo = gr.Interface(fn=analyze_text,
|
96 |
inputs=gr.Textbox(lines=2, placeholder="Enter Icelandic Text Here..."),
|
97 |
outputs=gr.Textbox(label="Analysis Results"),
|