Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,20 +1,26 @@
|
|
| 1 |
|
| 2 |
|
| 3 |
import gradio as gr
|
| 4 |
-
from gradio.mix import Series
|
| 5 |
|
| 6 |
-
|
| 7 |
-
title = "
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
)
|
| 16 |
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
|
|
|
|
| 1 |
|
| 2 |
|
| 3 |
import gradio as gr
|
|
|
|
| 4 |
|
| 5 |
+
# 1. Define your title and description
|
| 6 |
+
title = "Spanish Songs Toxicity Classification"
|
| 7 |
+
description = "Pretrained models: ES-EN Translation (Opus MT) + Roberta Toxicity Classifier"
|
| 8 |
+
|
| 9 |
+
# 2. Load the models using the modern gr.load syntax
|
| 10 |
+
# Note: Adding "models/" prefix is the standard for the Hub
|
| 11 |
+
translator_es = gr.load("models/Helsinki-NLP/opus-mt-es-en")
|
| 12 |
+
toxicity_classifier = gr.load("models/SkolkovoInstitute/roberta_toxicity_classifier")
|
| 13 |
+
|
| 14 |
+
# 3. Use gr.Series to chain them together
|
| 15 |
+
# This passes the output of the translator directly into the classifier
|
| 16 |
+
interface = gr.Series(
|
| 17 |
+
translator_es,
|
| 18 |
+
toxicity_classifier,
|
| 19 |
+
description=description,
|
| 20 |
+
title=title
|
| 21 |
)
|
| 22 |
|
| 23 |
+
# 4. Launch the app
|
| 24 |
+
if __name__ == "__main__":
|
| 25 |
+
interface.launch()
|
| 26 |
|