You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
f"Translation timeout for chunk {index+1} of file '{md_file_path.name}': Request exceeded 300 seconds. Check your network connection and API response time."
176
+
f"Translation timeout for chunk {index+1} of file '{md_file_path.name}': "
f"No text detected in image '{Path(image_path).name}': The image may not contain readable text, or the text quality is too poor for recognition. Try using images with clear, high-contrast text."
112
+
f"No text detected in image '{Path(image_path).name}': "
113
+
f"The image may not contain clear, high-contrast text, or the text quality is too poor for recognition. "
114
+
f"Please ensure the image contains readable text."
f"Font file not found for language '{target_language_code}' at '{font_path}' in image '{Path(image_path).name}': Using default font. Install the required font or check font configuration."
209
+
f"Font file not found for language '{target_language_code}' at '{font_path}' in image '{Path(image_path).name}': "
210
+
f"Using default font. Install the required font or check font configuration."
f"Invalid text detection data in image '{Path(image_path).name}': Expected 8 coordinates but got {len(bounding_box_flat)}. The text detection may be corrupted."
235
+
f"Invalid text detection data in image '{Path(image_path).name}': "
236
+
f"Expected 8 coordinates but got {len(bounding_box_flat)}. "
237
+
f"The text detection may be corrupted."
233
238
)
234
239
continue
235
240
@@ -238,7 +243,8 @@ def plot_annotated_image(
238
243
)
239
244
iflen(bounding_box_tuples) <4:
240
245
logger.error(
241
-
f"Insufficient bounding box points in image '{Path(image_path).name}': Text detection data is incomplete. Try re-processing the image."
246
+
f"Insufficient bounding box points in image '{Path(image_path).name}': "
247
+
f"Text detection data is incomplete. Try re-processing the image."
242
248
)
243
249
continue
244
250
@@ -250,7 +256,8 @@ def plot_annotated_image(
250
256
angle=-angle# Invert angle for proper rotation.
251
257
exceptValueError:
252
258
logger.error(
253
-
f"Invalid bounding box coordinates in image '{Path(image_path).name}': Text detection geometry is malformed. The image may have distorted text regions."
259
+
f"Invalid bounding box coordinates in image '{Path(image_path).name}': "
260
+
f"Text detection geometry is malformed. The image may have distorted text regions."
f"Font file not found for language '{target_language_code}' at '{font_path}' in image '{Path(image_path).name}': Using default font. Install the required font or check font configuration."
298
+
f"Font file not found for language '{target_language_code}' at '{font_path}' in image '{Path(image_path).name}': "
299
+
f"Using default font. Install the required font or check font configuration."
292
300
)
293
301
font=ImageFont.load_default()
294
302
@@ -353,7 +361,8 @@ def plot_annotated_image(
353
361
font=ImageFont.truetype(font_path, font_size)
354
362
exceptIOError:
355
363
logger.error(
356
-
f"Font file not found for language '{target_language_code}' at '{font_path}' in image '{Path(image_path).name}': Using default font. Install the required font or check font configuration."
364
+
f"Font file not found for language '{target_language_code}' at '{font_path}' in image '{Path(image_path).name}': "
365
+
f"Using default font. Install the required font or check font configuration."
357
366
)
358
367
font=ImageFont.load_default()
359
368
@@ -461,7 +470,9 @@ def translate_image(
461
470
# Check if any text was recognized
462
471
ifnotline_bounding_boxes:
463
472
logger.info(
464
-
f"No text detected in image '{image_path.name}': Saving original image as translation result. The image may not contain readable text or text may be too small/blurry to detect."
473
+
f"No text detected in image '{image_path.name}': "
474
+
f"Saving original image as translation result. "
475
+
f"The image may not contain readable text or text may be too small/blurry to detect."
465
476
)
466
477
467
478
# Load the original image and save it with the new name
@@ -492,7 +503,8 @@ def translate_image(
492
503
493
504
exceptExceptionase:
494
505
logger.error(
495
-
f"Failed to translate image '{image_path.name}': {str(e)}. Saving original image instead. Check Computer Vision API configuration and image file accessibility."
506
+
f"Failed to translate image '{image_path.name}': {str(e)}. "
507
+
f"Saving original image instead."
496
508
)
497
509
498
510
# Load the original image and save it with the new name
@@ -543,5 +555,7 @@ def create(
543
555
except (ImportError, ValueError) ase:
544
556
logger.warning(f"Computer Vision is not properly configured: {e}")
545
557
raiseValueError(
546
-
"Computer Vision not configured: Missing required environment variables (AZURE_COMPUTER_VISION_KEY, AZURE_COMPUTER_VISION_ENDPOINT). Please check your .env file and API configuration."
558
+
"Image translation is not configured: Missing required environment variables "
0 commit comments