KhacHuy commited on
Commit
fd67e65
·
verified ·
1 Parent(s): f242672

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
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
- model_gpu = model.cuda().to(torch.bfloat16)
48
- print("✅ Model is on GPU.")
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)