Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -44,24 +44,22 @@ def analyze_text(icelandic_text):
|
|
44 |
|
45 |
politeness_label, politeness_score = analyze_politeness(translated_text)
|
46 |
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
}
|
|
|
54 |
return analysis_results
|
55 |
|
56 |
demo = gr.Interface(fn=analyze_text,
|
57 |
inputs=gr.Textbox(lines=2, placeholder="Enter Icelandic Text Here..."),
|
58 |
-
outputs=
|
59 |
-
gr.Textbox(label="Sentiment"),
|
60 |
-
gr.Textbox(label="Formality"),
|
61 |
-
gr.Textbox(label="Toxicity"),
|
62 |
-
gr.Textbox(label="Politeness")],
|
63 |
title="Icelandic Text Analysis",
|
64 |
-
description="This app translates Icelandic text to English and performs sentiment, formality, toxicity, and politeness analysis."
|
|
|
65 |
|
66 |
if __name__ == "__main__":
|
67 |
-
demo.launch()
|
|
|
44 |
|
45 |
politeness_label, politeness_score = analyze_politeness(translated_text)
|
46 |
|
47 |
+
# Combine all analysis results into a single string
|
48 |
+
analysis_results = f"""
|
49 |
+
Translated Text: {translated_text}
|
50 |
+
Sentiment: Label: {sentiment_label}, Score: {round(sentiment_score, 2)}
|
51 |
+
Formality: Label: {formality_label}, Score: {round(formality_score, 2)}
|
52 |
+
Toxicity: Score: {round(toxicity_results['score'], 2)}
|
53 |
+
Politeness: Label: {politeness_label}, Score: {round(politeness_score, 2)}
|
54 |
+
"""
|
55 |
return analysis_results
|
56 |
|
57 |
demo = gr.Interface(fn=analyze_text,
|
58 |
inputs=gr.Textbox(lines=2, placeholder="Enter Icelandic Text Here..."),
|
59 |
+
outputs=gr.Textbox(label="Analysis Results"),
|
|
|
|
|
|
|
|
|
60 |
title="Icelandic Text Analysis",
|
61 |
+
description="This app translates Icelandic text to English and performs sentiment, formality, toxicity, and politeness analysis.",
|
62 |
+
share=True)
|
63 |
|
64 |
if __name__ == "__main__":
|
65 |
+
demo.launch()
|