@@ -375,6 +375,10 @@ def create_image_task(
375375 if not utils .is_image_supported_ext (file_path ):
376376 raise FastLabelInvalidException (
377377 "Supported extensions are png, jpg, jpeg." , 422 )
378+ if not utils .is_image_supported_size (file_path ):
379+ raise FastLabelInvalidException (
380+ f"Supported image size is under 20 MB." , 422 )
381+
378382 file = utils .base64_encode (file_path )
379383 payload = {"project" : project , "name" : name , "file" : file }
380384 if status :
@@ -424,6 +428,10 @@ def create_image_classification_task(
424428 if not utils .is_image_supported_ext (file_path ):
425429 raise FastLabelInvalidException (
426430 "Supported extensions are png, jpg, jpeg." , 422 )
431+ if not utils .is_image_supported_size (file_path ):
432+ raise FastLabelInvalidException (
433+ f"Supported image size is under 20 MB." , 422 )
434+
427435 file = utils .base64_encode (file_path )
428436 payload = {"project" : project , "name" : name , "file" : file }
429437 if status :
@@ -483,6 +491,10 @@ def create_multi_image_task(
483491 raise FastLabelInvalidException (
484492 "Supported extensions are png, jpg, jpeg." , 422 )
485493
494+ if not utils .is_image_supported_size (file_path ):
495+ raise FastLabelInvalidException (
496+ f"Supported image size is under 20 MB." , 422 )
497+
486498 if len (contents ) == 250 :
487499 raise FastLabelInvalidException (
488500 "The count of files should be under 250" , 422 )
@@ -543,7 +555,7 @@ def create_video_task(
543555 if not utils .is_video_supported_ext (file_path ):
544556 raise FastLabelInvalidException (
545557 "Supported extensions are mp4." , 422 )
546- if os . path . getsize (file_path ) > const . SUPPORTED_VIDEO_SIZE :
558+ if not utils . is_video_supported_size (file_path ):
547559 raise FastLabelInvalidException (
548560 f"Supported video size is under 250 MB." , 422 )
549561
@@ -596,7 +608,7 @@ def create_video_classification_task(
596608 if not utils .is_video_supported_ext (file_path ):
597609 raise FastLabelInvalidException (
598610 "Supported extensions are mp4." , 422 )
599- if os . path . getsize (file_path ) > const . SUPPORTED_VIDEO_SIZE :
611+ if not utils . is_video_supported_size (file_path ):
600612 raise FastLabelInvalidException (
601613 f"Supported video size is under 250 MB." , 422 )
602614
0 commit comments