Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -34,7 +34,7 @@ def find_result_image(path):
|
|
| 34 |
return None
|
| 35 |
|
| 36 |
# --- 2. Main Processing Function (UPDATED for multi-bbox drawing) ---
|
| 37 |
-
@spaces.GPU
|
| 38 |
def process_ocr_task(image, model_size, task_type, ref_text):
|
| 39 |
"""
|
| 40 |
Processes an image with DeepSeek-OCR for all supported tasks.
|
|
@@ -44,8 +44,8 @@ def process_ocr_task(image, model_size, task_type, ref_text):
|
|
| 44 |
return "Please upload an image first.", None
|
| 45 |
|
| 46 |
print("🚀 Moving model to GPU...")
|
| 47 |
-
|
| 48 |
-
|
| 49 |
|
| 50 |
with tempfile.TemporaryDirectory() as output_path:
|
| 51 |
# Build the prompt... (same as before)
|
|
|
|
| 34 |
return None
|
| 35 |
|
| 36 |
# --- 2. Main Processing Function (UPDATED for multi-bbox drawing) ---
|
| 37 |
+
# @spaces.GPU
|
| 38 |
def process_ocr_task(image, model_size, task_type, ref_text):
|
| 39 |
"""
|
| 40 |
Processes an image with DeepSeek-OCR for all supported tasks.
|
|
|
|
| 44 |
return "Please upload an image first.", None
|
| 45 |
|
| 46 |
print("🚀 Moving model to GPU...")
|
| 47 |
+
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 48 |
+
model = model.to(device)
|
| 49 |
|
| 50 |
with tempfile.TemporaryDirectory() as output_path:
|
| 51 |
# Build the prompt... (same as before)
|