pzangara commited on
Commit
9b92b44
1 Parent(s): 7a59383

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -10
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
- classifier = pipeline("zero-shot-classification", model="MoritzLaurer/mDeBERTa-v3-base-mnli-xnli",tokenizer=tokenizer)
16
- sequence_to_classify = "Metió 5 goles en dos minutos"
17
- candidate_labels = ["futbol","rugby","basket","tenis","golf","automovilismo","ciclismo"]
18
- output = classifier(sequence_to_classify, candidate_labels, multi_label=False)
 
 
 
 
 
 
 
19
 
20
- demo = gr.Interface(fn=classifier, inputs=(sequence_to_classify, candidate_labels, multi_label=False), outputs="label")
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()