Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -19,15 +19,15 @@ from transformers import pipeline
|
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
-
sp_model ="JonatanGk/roberta-base-bne-finetuned-cyberbullying-spanish"
|
| 23 |
ca_model = "JonatanGk/roberta-base-ca-finetuned-cyberbullying-catalan"
|
| 24 |
sp_analysis = pipeline("text-classification", model=sp_model, tokenizer=sp_model)
|
| 25 |
ca_analysis = pipeline("text-classification", model=ca_model, tokenizer=ca_model)
|
| 26 |
|
| 27 |
def bullying_analysis(language, text):
|
| 28 |
-
if language == '
|
| 29 |
results = sp_analysis(text)
|
| 30 |
-
elif language == '
|
| 31 |
results = ca_analysis(text)
|
| 32 |
return results[0]["label"], round(results[0]["score"], 5)
|
| 33 |
|
|
|
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
+
sp_model = "JonatanGk/roberta-base-bne-finetuned-cyberbullying-spanish"
|
| 23 |
ca_model = "JonatanGk/roberta-base-ca-finetuned-cyberbullying-catalan"
|
| 24 |
sp_analysis = pipeline("text-classification", model=sp_model, tokenizer=sp_model)
|
| 25 |
ca_analysis = pipeline("text-classification", model=ca_model, tokenizer=ca_model)
|
| 26 |
|
| 27 |
def bullying_analysis(language, text):
|
| 28 |
+
if language == 'Spanish':
|
| 29 |
results = sp_analysis(text)
|
| 30 |
+
elif language == 'Catalan':
|
| 31 |
results = ca_analysis(text)
|
| 32 |
return results[0]["label"], round(results[0]["score"], 5)
|
| 33 |
|