anitalp commited on
Commit
b8904a0
Β·
verified Β·
1 Parent(s): 8cbc6a6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -13
app.py CHANGED
@@ -1,20 +1,26 @@
1
 
2
 
3
  import gradio as gr
4
- from gradio.mix import Series
5
 
6
- description = "Spanish songs toxicity classification"
7
- title = "Pretrained models: ES-EN Translation Opus MT/ Roberta Toxicity classifier "
8
-
9
- translator_es = gr.Interface.load("huggingface/Helsinki-NLP/opus-mt-es-en")
10
- story_gen = gr.Interface.load("huggingface/SkolkovoInstitute/roberta_toxicity_classifier")
11
-
12
-
13
- interface = Series( translator_es, story_gen, description = description,
14
- title = title
 
 
 
 
 
 
 
15
  )
16
 
17
- interface.launch()
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