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

add image editor

Browse files
Files changed (1) hide show
  1. app.py +2 -4
app.py CHANGED
@@ -40,10 +40,9 @@ 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
- 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
-
47
  unique_id = str(uuid.uuid4())
48
  image_path = os.path.join(UPLOAD_FOLDER, f"{unique_id}.png")
49
  result_path = os.path.join(RESULTS_FOLDER, f"{unique_id}.html")
@@ -127,11 +126,10 @@ def update_inputs(task):
127
  def ocr_demo(image, task, ocr_type, ocr_box, ocr_color):
128
  res, html_content, unique_id = process_image(image, task, ocr_type, ocr_box, ocr_color)
129
 
130
- if res.startswith("Error:"):
131
  return res, None
132
 
133
  res = res.replace("\\title", "\\title ")
134
-
135
  res = f"$$ {res} $$"
136
 
137
  if html_content:
 
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
+
46
  unique_id = str(uuid.uuid4())
47
  image_path = os.path.join(UPLOAD_FOLDER, f"{unique_id}.png")
48
  result_path = os.path.join(RESULTS_FOLDER, f"{unique_id}.html")
 
126
  def ocr_demo(image, task, ocr_type, ocr_box, ocr_color):
127
  res, html_content, unique_id = process_image(image, task, ocr_type, ocr_box, ocr_color)
128
 
129
+ if isinstance(res, str) and res.startswith("Error:"):
130
  return res, None
131
 
132
  res = res.replace("\\title", "\\title ")
 
133
  res = f"$$ {res} $$"
134
 
135
  if html_content: