Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -103,7 +103,7 @@ def reset_all():
|
|
103 |
@spaces.GPU()
|
104 |
def preprocess_image(image_array, session_id):
|
105 |
if image_array is None:
|
106 |
-
return "❌ Please upload an image first.",
|
107 |
|
108 |
base_dir = os.path.join(os.environ["PIXEL3DMM_PREPROCESSED_DATA"], session_id)
|
109 |
os.makedirs(base_dir, exist_ok=True)
|
@@ -119,7 +119,7 @@ def preprocess_image(image_array, session_id):
|
|
119 |
except subprocess.CalledProcessError as e:
|
120 |
err = f"❌ Preprocess failed (exit {e.returncode}).\n\n{e.stdout}\n{e.stderr}"
|
121 |
shutil.rmtree(base_dir, ignore_errors=True)
|
122 |
-
return err, None,
|
123 |
|
124 |
crop_dir = os.path.join(os.environ["PIXEL3DMM_PREPROCESSED_DATA"], session_id, "cropped")
|
125 |
image = first_image_from_dir(crop_dir)
|
|
|
103 |
@spaces.GPU()
|
104 |
def preprocess_image(image_array, session_id):
|
105 |
if image_array is None:
|
106 |
+
return "❌ Please upload an image first.", gr.update(interactive=True), gr.update(interactive=True)
|
107 |
|
108 |
base_dir = os.path.join(os.environ["PIXEL3DMM_PREPROCESSED_DATA"], session_id)
|
109 |
os.makedirs(base_dir, exist_ok=True)
|
|
|
119 |
except subprocess.CalledProcessError as e:
|
120 |
err = f"❌ Preprocess failed (exit {e.returncode}).\n\n{e.stdout}\n{e.stderr}"
|
121 |
shutil.rmtree(base_dir, ignore_errors=True)
|
122 |
+
return err, None, gr.update(interactive=True), gr.update(interactive=True)
|
123 |
|
124 |
crop_dir = os.path.join(os.environ["PIXEL3DMM_PREPROCESSED_DATA"], session_id, "cropped")
|
125 |
image = first_image_from_dir(crop_dir)
|