sitammeur commited on
Commit
63f33c0
Β·
verified Β·
1 Parent(s): 936e343

Update src/app/task.py

Browse files
Files changed (1) hide show
  1. src/app/task.py +4 -0
src/app/task.py CHANGED
@@ -23,6 +23,10 @@ def ocr_task(image: Image.Image) -> Tuple[Image.Image, str]:
23
  tuple: A tuple containing the output image with OCR bounding boxes drawn and the cleaned OCR text.
24
  """
25
  try:
 
 
 
 
26
  # Task prompts
27
  ocr_prompt = "<OCR>"
28
  ocr_with_region_prompt = "<OCR_WITH_REGION>"
 
23
  tuple: A tuple containing the output image with OCR bounding boxes drawn and the cleaned OCR text.
24
  """
25
  try:
26
+ # Check if image is None
27
+ if image is None:
28
+ raise gr.Error("Please provide an image.")
29
+
30
  # Task prompts
31
  ocr_prompt = "<OCR>"
32
  ocr_with_region_prompt = "<OCR_WITH_REGION>"