murcherful commited on
Commit
37c8efc
·
1 Parent(s): df28fed

update app

Browse files
Files changed (1) hide show
  1. app.py +16 -22
app.py CHANGED
@@ -117,6 +117,7 @@ with gr.Blocks() as demo:
117
  This demo allows you to generate parts given a 3D model using Hunyuan3D-Part.
118
  First segment the 3D model using P3-SAM and then generate parts using XPart.
119
  Please upload glb ply or obj 3D model files.
 
120
  '''
121
  )
122
  with gr.Row():
@@ -146,28 +147,7 @@ You can also use the "Connectivity" and "Post-processing" options to control the
146
  The "Post-processing" will merge the small parts according to the threshold. The smaller the threshold, the more parts will be merged.
147
  '''
148
  )
149
- gr.Examples(examples=[
150
- 'P3-SAM/demo/assets/1.glb',
151
- 'P3-SAM/demo/assets/2.glb',
152
- 'P3-SAM/demo/assets/4.glb',
153
- 'XPart/data/000.glb',
154
- 'XPart/data/001.glb',
155
- 'XPart/data/002.glb',
156
- 'XPart/data/003.glb',
157
- 'XPart/data/004.glb',
158
- ],
159
- inputs = [p3sam_input],
160
- example_labels=[
161
- 'Female Warrior',
162
- 'Suspended Island',
163
- 'Beetle Car',
164
- 'Koi Fish',
165
- 'Motorcycle',
166
- 'Gundam',
167
- 'Computer Desk',
168
- 'Coffee Machine'
169
- ]
170
- )
171
  with gr.Column():
172
  # XPart
173
  gr.Markdown(
@@ -185,6 +165,20 @@ Input a mesh, segment it using P3-SAM on the left, and push the "Generate" butto
185
  xpart_output_exploded = gr.Model3D(clear_color=[0.0, 0.0, 0.0, 0.0], label="Exploded Object")
186
  xpart_seed = gr.Number(value=42, label="Random Seed")
187
  gr_state = gr.State(value=[(None, None)])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
188
  p3sam_button.click(segment, inputs=[p3sam_input, p3sam_postprocess, p3sam_postprocess_threshold, p3sam_seed], outputs=[p3sam_output, p3sam_face_id_output, gr_state])
189
  xpart_button.click(generate, inputs=[p3sam_input, xpart_seed, gr_state], outputs=[xpart_output, xpart_output_bbox, xpart_output_exploded])
190
 
 
117
  This demo allows you to generate parts given a 3D model using Hunyuan3D-Part.
118
  First segment the 3D model using P3-SAM and then generate parts using XPart.
119
  Please upload glb ply or obj 3D model files.
120
+ Our examples are at the bottoms.
121
  '''
122
  )
123
  with gr.Row():
 
147
  The "Post-processing" will merge the small parts according to the threshold. The smaller the threshold, the more parts will be merged.
148
  '''
149
  )
150
+ image_dump = gr.Image(label="Ref Image", visible=False)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
151
  with gr.Column():
152
  # XPart
153
  gr.Markdown(
 
165
  xpart_output_exploded = gr.Model3D(clear_color=[0.0, 0.0, 0.0, 0.0], label="Exploded Object")
166
  xpart_seed = gr.Number(value=42, label="Random Seed")
167
  gr_state = gr.State(value=[(None, None)])
168
+ with gr.Row():
169
+ gr.Examples(examples=[
170
+ ['P3-SAM/demo/assets/Female_Warrior.png' , 'P3-SAM/demo/assets/Female_Warrior.glb' ],
171
+ ['P3-SAM/demo/assets/Suspended_Island.png' , 'P3-SAM/demo/assets/Suspended_Island.glb' ],
172
+ ['P3-SAM/demo/assets/Beetle_Car.png' , 'P3-SAM/demo/assets/Beetle_Car.glb' ],
173
+ ['XPart/data/Koi_Fish.png' , 'XPart/data/Koi_Fish.glb' ],
174
+ ['XPart/data/Motorcycle.png' , 'XPart/data/Motorcycle.glb' ],
175
+ ['XPart/data/Gundam.png' , 'XPart/data/Gundam.glb' ],
176
+ ['XPart/data/Computer_Desk.png' , 'XPart/data/Computer_Desk.glb' ],
177
+ ['XPart/data/Coffee_Machine.png' , 'XPart/data/Coffee_Machine.glb' ],
178
+ ],
179
+ inputs = [image_dump, p3sam_input],
180
+ )
181
+
182
  p3sam_button.click(segment, inputs=[p3sam_input, p3sam_postprocess, p3sam_postprocess_threshold, p3sam_seed], outputs=[p3sam_output, p3sam_face_id_output, gr_state])
183
  xpart_button.click(generate, inputs=[p3sam_input, xpart_seed, gr_state], outputs=[xpart_output, xpart_output_bbox, xpart_output_exploded])
184