Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -5,6 +5,7 @@ from transformers import pipeline, AutoTokenizer, AutoModelForSequenceClassifica
|
|
5 |
import transformers
|
6 |
import gradio as gr
|
7 |
from pysentimiento import create_analyzer
|
|
|
8 |
|
9 |
model_name = "MoritzLaurer/mDeBERTa-v3-base-xnli-multilingual-nli-2mil7"
|
10 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
@@ -14,7 +15,8 @@ def clasificador(input1, input2):
|
|
14 |
sequence_to_classify = input1
|
15 |
input2_list = input2.split(",") # Parse the input string as a list
|
16 |
candidate_labels= [item.strip() for item in input2_list]
|
17 |
-
|
|
|
18 |
analyzer = create_analyzer(task="sentiment", lang="es")
|
19 |
output2=analyzer.predict(input1)
|
20 |
return output1, output2
|
|
|
5 |
import transformers
|
6 |
import gradio as gr
|
7 |
from pysentimiento import create_analyzer
|
8 |
+
import pandas as pd
|
9 |
|
10 |
model_name = "MoritzLaurer/mDeBERTa-v3-base-xnli-multilingual-nli-2mil7"
|
11 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
|
|
15 |
sequence_to_classify = input1
|
16 |
input2_list = input2.split(",") # Parse the input string as a list
|
17 |
candidate_labels= [item.strip() for item in input2_list]
|
18 |
+
output0 = classifier(sequence_to_classify, candidate_labels, multi_label=False)
|
19 |
+
output1=pd.DataFrame(output0)
|
20 |
analyzer = create_analyzer(task="sentiment", lang="es")
|
21 |
output2=analyzer.predict(input1)
|
22 |
return output1, output2
|