alexnasa commited on
Commit
403a6e7
·
verified ·
1 Parent(s): f20db52

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -5
app.py CHANGED
@@ -215,7 +215,7 @@ def step4_track(session_id):
215
 
216
  # New: run all steps sequentially
217
  @spaces.GPU()
218
- def generate_results_and_mesh(image, session_id):
219
 
220
  """
221
  Process an input image through a 3D reconstruction pipeline and return the intermediate outputs and mesh file.
@@ -240,7 +240,9 @@ def generate_results_and_mesh(image, session_id):
240
  - track_img (Image or None): Tracking/registration result.
241
  - mesh_file (str or None): Path to the generated 3D mesh (`.ply`), if found.
242
  """
243
-
 
 
244
  # Step 1
245
  status1, crop_img, _, _ = preprocess_image(image, session_id)
246
  if "❌" in status1:
@@ -322,10 +324,11 @@ with gr.Blocks(css=css) as demo:
322
 
323
  examples = gr.Examples(
324
  examples=[
325
- ["example_images/jim_carrey.png", None],
326
- ["example_images/margaret_qualley.png", None],
 
327
  ],
328
- inputs=[image_in, session_state],
329
  outputs=[status, crop_img, normals_img, uv_img, track_img, mesh_file],
330
  fn=generate_results_and_mesh,
331
  cache_examples=True
 
215
 
216
  # New: run all steps sequentially
217
  @spaces.GPU()
218
+ def generate_results_and_mesh(image, session_id=None):
219
 
220
  """
221
  Process an input image through a 3D reconstruction pipeline and return the intermediate outputs and mesh file.
 
240
  - track_img (Image or None): Tracking/registration result.
241
  - mesh_file (str or None): Path to the generated 3D mesh (`.ply`), if found.
242
  """
243
+ if session_id is None:
244
+ session_id = uuid.uuid4().hex
245
+
246
  # Step 1
247
  status1, crop_img, _, _ = preprocess_image(image, session_id)
248
  if "❌" in status1:
 
324
 
325
  examples = gr.Examples(
326
  examples=[
327
+ ["example_images/jennifer_lawrence.png"],
328
+ ["example_images/jim_carrey.png"],
329
+ ["example_images/margaret_qualley.png"],
330
  ],
331
+ inputs=[image_in],
332
  outputs=[status, crop_img, normals_img, uv_img, track_img, mesh_file],
333
  fn=generate_results_and_mesh,
334
  cache_examples=True