Spaces:
Configuration error
Configuration error
Update app.py
Browse files
app.py
CHANGED
|
@@ -11,9 +11,12 @@ import tempfile
|
|
| 11 |
import time
|
| 12 |
import shutil
|
| 13 |
from pathlib import Path
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
tokenizer = AutoTokenizer.from_pretrained('ucaslcl/GOT-OCR2_0', trust_remote_code=True)
|
| 16 |
-
model = AutoModel.from_pretrained('ucaslcl/GOT-OCR2_0', trust_remote_code=True, low_cpu_mem_usage=True, device_map=
|
| 17 |
model = model.eval().cuda()
|
| 18 |
|
| 19 |
UPLOAD_FOLDER = "./uploads"
|
|
|
|
| 11 |
import time
|
| 12 |
import shutil
|
| 13 |
from pathlib import Path
|
| 14 |
+
import torch
|
| 15 |
+
|
| 16 |
+
DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
|
| 17 |
|
| 18 |
tokenizer = AutoTokenizer.from_pretrained('ucaslcl/GOT-OCR2_0', trust_remote_code=True)
|
| 19 |
+
model = AutoModel.from_pretrained('ucaslcl/GOT-OCR2_0', trust_remote_code=True, low_cpu_mem_usage=True, device_map=DEVICE, use_safetensors=True)
|
| 20 |
model = model.eval().cuda()
|
| 21 |
|
| 22 |
UPLOAD_FOLDER = "./uploads"
|