Tonic commited on
Commit
464330e
Β·
unverified Β·
1 Parent(s): acefffe

add image editor

Browse files
Files changed (1) hide show
  1. app.py +3 -0
app.py CHANGED
@@ -40,6 +40,7 @@ def image_to_base64(image):
40
 
41
  @spaces.GPU()
42
  def process_image(image, task, ocr_type=None, ocr_box=None, ocr_color=None):
 
43
  if image is None:
44
  return "Error: No image provided", None, None
45
 
@@ -53,6 +54,8 @@ def process_image(image, task, ocr_type=None, ocr_box=None, ocr_color=None):
53
  if composite_image is not None:
54
  if isinstance(composite_image, np.ndarray):
55
  cv2.imwrite(image_path, cv2.cvtColor(composite_image, cv2.COLOR_RGB2BGR))
 
 
56
  else:
57
  return "Error: Unsupported image format from ImageEditor", None, None
58
  else:
 
40
 
41
  @spaces.GPU()
42
  def process_image(image, task, ocr_type=None, ocr_box=None, ocr_color=None):
43
+ def process_image(image, task, ocr_type=None, ocr_box=None, ocr_color=None):
44
  if image is None:
45
  return "Error: No image provided", None, None
46
 
 
54
  if composite_image is not None:
55
  if isinstance(composite_image, np.ndarray):
56
  cv2.imwrite(image_path, cv2.cvtColor(composite_image, cv2.COLOR_RGB2BGR))
57
+ elif isinstance(composite_image, Image.Image):
58
+ composite_image.save(image_path)
59
  else:
60
  return "Error: Unsupported image format from ImageEditor", None, None
61
  else: