Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -5,17 +5,19 @@ from transformers import pipeline, AutoTokenizer, AutoModelForSequenceClassifica
|
|
5 |
import transformers
|
6 |
import gradio as gr
|
7 |
|
8 |
-
|
9 |
-
def image_classifier(inp):
|
10 |
-
return {'cat': 0.3, 'dog': 0.7}
|
11 |
-
|
12 |
model_name = "MoritzLaurer/mDeBERTa-v3-base-xnli-multilingual-nli-2mil7"
|
13 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
|
20 |
-
|
21 |
-
demo.launch()
|
|
|
5 |
import transformers
|
6 |
import gradio as gr
|
7 |
|
|
|
|
|
|
|
|
|
8 |
model_name = "MoritzLaurer/mDeBERTa-v3-base-xnli-multilingual-nli-2mil7"
|
9 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
10 |
|
11 |
+
def clasificador(input)
|
12 |
+
classifier = pipeline("zero-shot-classification", model="MoritzLaurer/mDeBERTa-v3-base-mnli-xnli",tokenizer=tokenizer)
|
13 |
+
sequence_to_classify = input
|
14 |
+
candidate_labels = ["futbol","rugby","basket","tenis","golf","automovilismo","ciclismo"]
|
15 |
+
output = classifier(sequence_to_classify, candidate_labels, multi_label=False)
|
16 |
+
return output
|
17 |
+
|
18 |
+
|
19 |
+
def application():
|
20 |
+
app = gradio.Interface(fn=clasificador, inputs="text", outputs="text", title="Clasificador de geografías urbanas")
|
21 |
+
return app.launch()
|
22 |
|
23 |
+
application()
|
|