Update src/app/task.py
Browse files- 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>"
|