Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -5,7 +5,7 @@ import gradio as gr
|
|
5 |
translator = pipeline("translation", model="Helsinki-NLP/opus-mt-is-en")
|
6 |
sentiment_classifier = pipeline("text-classification", model="Birkir/electra-base-igc-is-sentiment-analysis")
|
7 |
formality_classifier = pipeline("text-classification", model="svanhvit/formality-classification-icebert")
|
8 |
-
detoxify_pipeline = pipeline('text-classification', model='unitary/toxic-bert', tokenizer='bert-base-uncased', function_to_apply='sigmoid',
|
9 |
politeness_classifier = pipeline("text-classification", model="Genius1237/xlm-roberta-large-tydip")
|
10 |
|
11 |
def translate_text(text):
|
@@ -54,7 +54,7 @@ def analyze_text(icelandic_text):
|
|
54 |
return analysis_results
|
55 |
|
56 |
demo = gr.Interface(fn=analyze_text,
|
57 |
-
inputs="
|
58 |
outputs=[gr.outputs.Textbox(label="Translated Text"),
|
59 |
gr.outputs.Textbox(label="Sentiment"),
|
60 |
gr.outputs.Textbox(label="Formality"),
|
@@ -64,4 +64,4 @@ demo = gr.Interface(fn=analyze_text,
|
|
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()
|
|
|
5 |
translator = pipeline("translation", model="Helsinki-NLP/opus-mt-is-en")
|
6 |
sentiment_classifier = pipeline("text-classification", model="Birkir/electra-base-igc-is-sentiment-analysis")
|
7 |
formality_classifier = pipeline("text-classification", model="svanhvit/formality-classification-icebert")
|
8 |
+
detoxify_pipeline = pipeline('text-classification', model='unitary/toxic-bert', tokenizer='bert-base-uncased', function_to_apply='sigmoid', top_k=None)
|
9 |
politeness_classifier = pipeline("text-classification", model="Genius1237/xlm-roberta-large-tydip")
|
10 |
|
11 |
def translate_text(text):
|
|
|
54 |
return analysis_results
|
55 |
|
56 |
demo = gr.Interface(fn=analyze_text,
|
57 |
+
inputs=gr.inputs.Textbox(lines=2, placeholder="Enter Icelandic Text Here..."),
|
58 |
outputs=[gr.outputs.Textbox(label="Translated Text"),
|
59 |
gr.outputs.Textbox(label="Sentiment"),
|
60 |
gr.outputs.Textbox(label="Formality"),
|
|
|
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()
|