Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -196,35 +196,6 @@ def make3d(images):
|
|
| 196 |
# get triplane
|
| 197 |
planes = model.forward_planes(images, input_cameras)
|
| 198 |
|
| 199 |
-
# # get video
|
| 200 |
-
# chunk_size = 20 if IS_FLEXICUBES else 1
|
| 201 |
-
# render_size = 384
|
| 202 |
-
|
| 203 |
-
# frames = []
|
| 204 |
-
# for i in tqdm(range(0, render_cameras.shape[1], chunk_size)):
|
| 205 |
-
# if IS_FLEXICUBES:
|
| 206 |
-
# frame = model.forward_geometry(
|
| 207 |
-
# planes,
|
| 208 |
-
# render_cameras[:, i:i+chunk_size],
|
| 209 |
-
# render_size=render_size,
|
| 210 |
-
# )['img']
|
| 211 |
-
# else:
|
| 212 |
-
# frame = model.synthesizer(
|
| 213 |
-
# planes,
|
| 214 |
-
# cameras=render_cameras[:, i:i+chunk_size],
|
| 215 |
-
# render_size=render_size,
|
| 216 |
-
# )['images_rgb']
|
| 217 |
-
# frames.append(frame)
|
| 218 |
-
# frames = torch.cat(frames, dim=1)
|
| 219 |
-
|
| 220 |
-
# images_to_video(
|
| 221 |
-
# frames[0],
|
| 222 |
-
# video_fpath,
|
| 223 |
-
# fps=30,
|
| 224 |
-
# )
|
| 225 |
-
|
| 226 |
-
# print(f"Video saved to {video_fpath}")
|
| 227 |
-
|
| 228 |
# get mesh
|
| 229 |
mesh_out = model.extract_mesh(
|
| 230 |
planes,
|
|
@@ -245,10 +216,13 @@ def make3d(images):
|
|
| 245 |
|
| 246 |
_HEADER_ = """
|
| 247 |
## Step 1: Generate the 3D Mesh
|
| 248 |
-
For this step, we use <a href='https://github.com/TencentARC/InstantMesh' target='_blank'>InstantMesh</a>, an open-source model for **fast** feedforward 3D mesh generation from a single image.
|
| 249 |
-
|
|
|
|
|
|
|
| 250 |
## 💡 Tips
|
| 251 |
-
|
|
|
|
| 252 |
- The 3D mesh generation results highly depend on the quality of generated multi-view images. Please try a different **seed value** if the result is unsatisfying (Default: 42).
|
| 253 |
"""
|
| 254 |
|
|
@@ -292,17 +266,6 @@ with gr.Blocks() as demo:
|
|
| 292 |
with gr.Row():
|
| 293 |
submit = gr.Button("Generate", elem_id="generate", variant="primary")
|
| 294 |
|
| 295 |
-
with gr.Row(variant="panel"):
|
| 296 |
-
gr.Examples(
|
| 297 |
-
examples=[
|
| 298 |
-
os.path.join("examples", img_name) for img_name in sorted(os.listdir("examples"))
|
| 299 |
-
],
|
| 300 |
-
inputs=[input_image],
|
| 301 |
-
label="Examples",
|
| 302 |
-
cache_examples=False,
|
| 303 |
-
examples_per_page=16
|
| 304 |
-
)
|
| 305 |
-
|
| 306 |
with gr.Column():
|
| 307 |
|
| 308 |
with gr.Row():
|
|
@@ -315,14 +278,6 @@ with gr.Blocks() as demo:
|
|
| 315 |
interactive=False
|
| 316 |
)
|
| 317 |
|
| 318 |
-
# with gr.Column():
|
| 319 |
-
# output_video = gr.Video(
|
| 320 |
-
# label="video", format="mp4",
|
| 321 |
-
# width=379,
|
| 322 |
-
# autoplay=True,
|
| 323 |
-
# interactive=False
|
| 324 |
-
# )
|
| 325 |
-
|
| 326 |
with gr.Row():
|
| 327 |
with gr.Tab("OBJ"):
|
| 328 |
output_model_obj = gr.Model3D(
|
|
|
|
| 196 |
# get triplane
|
| 197 |
planes = model.forward_planes(images, input_cameras)
|
| 198 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 199 |
# get mesh
|
| 200 |
mesh_out = model.extract_mesh(
|
| 201 |
planes,
|
|
|
|
| 216 |
|
| 217 |
_HEADER_ = """
|
| 218 |
## Step 1: Generate the 3D Mesh
|
| 219 |
+
- For this step, we use <a href='https://github.com/TencentARC/InstantMesh' target='_blank'>InstantMesh</a>, an open-source model for **fast** feedforward 3D mesh generation from a single image.
|
| 220 |
+
|
| 221 |
+
- You need to upload an image of what you want to generate a 3D Model from.
|
| 222 |
+
|
| 223 |
## 💡 Tips
|
| 224 |
+
|
| 225 |
+
- If there's a background in your image -> ✅ Remove background.
|
| 226 |
- The 3D mesh generation results highly depend on the quality of generated multi-view images. Please try a different **seed value** if the result is unsatisfying (Default: 42).
|
| 227 |
"""
|
| 228 |
|
|
|
|
| 266 |
with gr.Row():
|
| 267 |
submit = gr.Button("Generate", elem_id="generate", variant="primary")
|
| 268 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 269 |
with gr.Column():
|
| 270 |
|
| 271 |
with gr.Row():
|
|
|
|
| 278 |
interactive=False
|
| 279 |
)
|
| 280 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 281 |
with gr.Row():
|
| 282 |
with gr.Tab("OBJ"):
|
| 283 |
output_model_obj = gr.Model3D(
|