fffiloni commited on
Commit
6b15dee
·
verified ·
1 Parent(s): 11f096a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -11
app.py CHANGED
@@ -34,14 +34,16 @@ import sys
34
  sys.path.append(HOLOPART_CODE_DIR)
35
  sys.path.append(os.path.join(HOLOPART_CODE_DIR, "scripts"))
36
 
37
- """
38
  EXAMPLES = [
39
- ["./holopart/assets/example_data/000.glb", "./holopart/assets/example_data/000.png"],
40
- ["./holopart/assets/example_data/001.glb", "./holopart/assets/example_data/001.png"],
41
- ["./holopart/assets/example_data/002.glb", "./holopart/assets/example_data/002.png"],
42
- ["./holopart/assets/example_data/003.glb", "./holopart/assets/example_data/003.png"],
 
 
43
  ]
44
- """
45
 
46
 
47
  HEADER = """
@@ -147,7 +149,7 @@ def visualize_input(mesh_in):
147
 
148
 
149
  @spaces.GPU(duration=600)
150
- def run_example(data_path: str, example_image_path, seed=42, num_inference_steps=25, guidance_scale=3.5):
151
 
152
  batch_size = 30
153
  parts_data = prepare_data(data_path)
@@ -226,16 +228,15 @@ with gr.Blocks(title="HoloPart") as demo:
226
  model_output = gr.Model3D(label="Decomposed GLB", interactive=False)
227
  exploded_parts_output = gr.Model3D(label="Exploded Parts", interactive=False)
228
 
229
- """
230
  with gr.Row():
231
  examples = gr.Examples(
232
  examples=EXAMPLES,
233
- fn=run_example,
234
  inputs=[input_mesh, example_image],
235
  outputs=[model_output, exploded_parts_output],
236
- cache_examples=True,
237
  )
238
- """
239
 
240
 
241
  input_mesh.upload(
@@ -245,6 +246,13 @@ with gr.Blocks(title="HoloPart") as demo:
245
  queue=False
246
  )
247
 
 
 
 
 
 
 
 
248
  gen_button.click(
249
  run_full,
250
  inputs=[
 
34
  sys.path.append(HOLOPART_CODE_DIR)
35
  sys.path.append(os.path.join(HOLOPART_CODE_DIR, "scripts"))
36
 
37
+
38
  EXAMPLES = [
39
+ ["./assets/example_data/000.glb", "./assets/example_data/000.PNG"],
40
+ ["./assets/example_data/001.glb", "./assets/example_data/001.PNG"],
41
+ ["./assets/example_data/002.glb", "./assets/example_data/002.PNG"],
42
+ ["./assets/example_data/003.glb", "./assets/example_data/003.PNG"],
43
+ ["./assets/example_data/004.glb", "./assets/example_data/004.PNG"],
44
+ ["./assets/example_data/005.glb", "./assets/example_data/005.PNG"]
45
  ]
46
+
47
 
48
 
49
  HEADER = """
 
149
 
150
 
151
  @spaces.GPU(duration=600)
152
+ def run_example(data_path: str, example_image, seed=42, num_inference_steps=25, guidance_scale=3.5):
153
 
154
  batch_size = 30
155
  parts_data = prepare_data(data_path)
 
228
  model_output = gr.Model3D(label="Decomposed GLB", interactive=False)
229
  exploded_parts_output = gr.Model3D(label="Exploded Parts", interactive=False)
230
 
231
+
232
  with gr.Row():
233
  examples = gr.Examples(
234
  examples=EXAMPLES,
 
235
  inputs=[input_mesh, example_image],
236
  outputs=[model_output, exploded_parts_output],
237
+ cache_examples="lazy",
238
  )
239
+
240
 
241
 
242
  input_mesh.upload(
 
246
  queue=False
247
  )
248
 
249
+ input_mesh.change(
250
+ fn = visualize_input,
251
+ inputs = [input_mesh],
252
+ outputs = [input_visualizer],
253
+ queue=False
254
+ )
255
+
256
  gen_button.click(
257
  run_full,
258
  inputs=[