Spaces:
Sleeping
Sleeping
Fernando Cervan
commited on
Commit
·
dc1f60b
1
Parent(s):
7124651
Salvando alterações
Browse files
app.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
from transformers import AutoProcessor,
|
2 |
from PIL import Image
|
3 |
import torch
|
4 |
|
@@ -12,12 +12,12 @@ prompt = "Extraia os seguintes dados do documento: [nome, cpf e data de nascimen
|
|
12 |
device = torch.device("cpu")
|
13 |
torch_dtype = torch.float32 # Usar precisão simples para economizar memória
|
14 |
|
15 |
-
# Adicione trust_remote_code=True aqui 👇
|
16 |
processor = AutoProcessor.from_pretrained(model_id, trust_remote_code=True)
|
17 |
-
|
|
|
18 |
model_id,
|
19 |
torch_dtype=torch_dtype,
|
20 |
-
trust_remote_code=True
|
21 |
).to(device)
|
22 |
|
23 |
# Preparar inputs
|
|
|
1 |
+
from transformers import AutoProcessor, AutoModel
|
2 |
from PIL import Image
|
3 |
import torch
|
4 |
|
|
|
12 |
device = torch.device("cpu")
|
13 |
torch_dtype = torch.float32 # Usar precisão simples para economizar memória
|
14 |
|
|
|
15 |
processor = AutoProcessor.from_pretrained(model_id, trust_remote_code=True)
|
16 |
+
|
17 |
+
model = AutoModel.from_pretrained(
|
18 |
model_id,
|
19 |
torch_dtype=torch_dtype,
|
20 |
+
trust_remote_code=True
|
21 |
).to(device)
|
22 |
|
23 |
# Preparar inputs
|