Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
import gradio as gr
|
2 |
-
from transformers import pipeline
|
3 |
import torch
|
4 |
|
5 |
# Verificando se a GPU está disponível
|
@@ -12,10 +12,17 @@ transcriber = pipeline(
|
|
12 |
device=device
|
13 |
)
|
14 |
|
15 |
-
# Carregando o
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
classifier = pipeline(
|
17 |
"zero-shot-classification",
|
18 |
model="joeddav/xlm-roberta-large-xnli",
|
|
|
19 |
device=device
|
20 |
)
|
21 |
|
|
|
1 |
import gradio as gr
|
2 |
+
from transformers import pipeline, AutoTokenizer
|
3 |
import torch
|
4 |
|
5 |
# Verificando se a GPU está disponível
|
|
|
12 |
device=device
|
13 |
)
|
14 |
|
15 |
+
# Carregando o tokenizer lento para o classificador
|
16 |
+
tokenizer = AutoTokenizer.from_pretrained(
|
17 |
+
"joeddav/xlm-roberta-large-xnli",
|
18 |
+
use_fast=False # Desativando o tokenizer rápido
|
19 |
+
)
|
20 |
+
|
21 |
+
# Carregando o pipeline de classificação zero-shot com o tokenizer lento
|
22 |
classifier = pipeline(
|
23 |
"zero-shot-classification",
|
24 |
model="joeddav/xlm-roberta-large-xnli",
|
25 |
+
tokenizer=tokenizer,
|
26 |
device=device
|
27 |
)
|
28 |
|