Update app.py
Browse files
app.py
CHANGED
|
@@ -321,37 +321,37 @@ def make3d(images):
|
|
| 321 |
# get triplane
|
| 322 |
planes = model.forward_planes(images, input_cameras)
|
| 323 |
|
| 324 |
-
# get video
|
| 325 |
-
chunk_size = 20 if IS_FLEXICUBES else 1
|
| 326 |
-
render_size = 512
|
| 327 |
|
| 328 |
-
frames = []
|
| 329 |
-
frames, albedos, pbr_spec_lights, pbr_diffuse_lights, normals, alphas = render_frames(
|
| 330 |
-
|
| 331 |
-
|
| 332 |
-
|
| 333 |
-
|
| 334 |
-
|
| 335 |
-
|
| 336 |
-
|
| 337 |
-
|
| 338 |
-
|
| 339 |
-
|
| 340 |
-
normals = (torch.nn.functional.normalize(normals) + 1) / 2
|
| 341 |
-
normals = normals * alphas + (1-alphas)
|
| 342 |
-
all_frames = torch.cat([frames, albedos, pbr_spec_lights, pbr_diffuse_lights, normals], dim=3)
|
| 343 |
|
| 344 |
-
images_to_video(
|
| 345 |
-
|
| 346 |
-
|
| 347 |
-
|
| 348 |
-
)
|
| 349 |
|
| 350 |
-
print(f"Video saved to {video_fpath}")
|
| 351 |
|
| 352 |
mesh_fpath, mesh_glb_fpath = make_mesh(mesh_fpath, planes)
|
| 353 |
-
|
| 354 |
-
return video_fpath, mesh_fpath, mesh_glb_fpath
|
| 355 |
|
| 356 |
|
| 357 |
import gradio as gr
|
|
@@ -361,7 +361,7 @@ _HEADER_ = '''
|
|
| 361 |
|
| 362 |
**PRM** is a feed-forward framework for high-quality 3D mesh generation with fine-grained local details from a single image.
|
| 363 |
|
| 364 |
-
Code: <a href='https://github.com/g3956/PRM' target='_blank'>GitHub</a>.
|
| 365 |
'''
|
| 366 |
|
| 367 |
_CITE_ = r"""
|
|
@@ -450,14 +450,14 @@ with gr.Blocks() as demo:
|
|
| 450 |
interactive=False
|
| 451 |
)
|
| 452 |
|
| 453 |
-
with gr.Column():
|
| 454 |
-
|
| 455 |
-
|
| 456 |
-
|
| 457 |
-
|
| 458 |
-
|
| 459 |
-
|
| 460 |
-
|
| 461 |
|
| 462 |
with gr.Row():
|
| 463 |
with gr.Tab("OBJ"):
|
|
@@ -492,7 +492,8 @@ with gr.Blocks() as demo:
|
|
| 492 |
).success(
|
| 493 |
fn=make3d,
|
| 494 |
inputs=[mv_images],
|
| 495 |
-
outputs=[
|
|
|
|
| 496 |
)
|
| 497 |
|
| 498 |
# demo.queue(max_size=10)
|
|
|
|
| 321 |
# get triplane
|
| 322 |
planes = model.forward_planes(images, input_cameras)
|
| 323 |
|
| 324 |
+
# # get video
|
| 325 |
+
# chunk_size = 20 if IS_FLEXICUBES else 1
|
| 326 |
+
# render_size = 512
|
| 327 |
|
| 328 |
+
# frames = []
|
| 329 |
+
# frames, albedos, pbr_spec_lights, pbr_diffuse_lights, normals, alphas = render_frames(
|
| 330 |
+
# model,
|
| 331 |
+
# planes,
|
| 332 |
+
# render_cameras=all_mvp,
|
| 333 |
+
# camera_pos=all_campos,
|
| 334 |
+
# env=ENV,
|
| 335 |
+
# materials=materials,
|
| 336 |
+
# render_size=render_size,
|
| 337 |
+
# chunk_size=chunk_size,
|
| 338 |
+
# is_flexicubes=IS_FLEXICUBES,
|
| 339 |
+
# )
|
| 340 |
+
# normals = (torch.nn.functional.normalize(normals) + 1) / 2
|
| 341 |
+
# normals = normals * alphas + (1-alphas)
|
| 342 |
+
# all_frames = torch.cat([frames, albedos, pbr_spec_lights, pbr_diffuse_lights, normals], dim=3)
|
| 343 |
|
| 344 |
+
# images_to_video(
|
| 345 |
+
# all_frames,
|
| 346 |
+
# video_fpath,
|
| 347 |
+
# fps=30,
|
| 348 |
+
# )
|
| 349 |
|
| 350 |
+
# print(f"Video saved to {video_fpath}")
|
| 351 |
|
| 352 |
mesh_fpath, mesh_glb_fpath = make_mesh(mesh_fpath, planes)
|
| 353 |
+
return mesh_fpath, mesh_glb_fpath
|
| 354 |
+
# return video_fpath, mesh_fpath, mesh_glb_fpath
|
| 355 |
|
| 356 |
|
| 357 |
import gradio as gr
|
|
|
|
| 361 |
|
| 362 |
**PRM** is a feed-forward framework for high-quality 3D mesh generation with fine-grained local details from a single image.
|
| 363 |
|
| 364 |
+
Code: <a href='https://github.com/g3956/PRM' target='_blank'>GitHub</a>. Techenical report: <a href='https://arxiv.org/abs/2404.07191' target='_blank'>ArXiv</a>.
|
| 365 |
'''
|
| 366 |
|
| 367 |
_CITE_ = r"""
|
|
|
|
| 450 |
interactive=False
|
| 451 |
)
|
| 452 |
|
| 453 |
+
# with gr.Column():
|
| 454 |
+
# with gr.Column():
|
| 455 |
+
# output_video = gr.Video(
|
| 456 |
+
# label="video", format="mp4",
|
| 457 |
+
# width=768,
|
| 458 |
+
# autoplay=True,
|
| 459 |
+
# interactive=False
|
| 460 |
+
# )
|
| 461 |
|
| 462 |
with gr.Row():
|
| 463 |
with gr.Tab("OBJ"):
|
|
|
|
| 492 |
).success(
|
| 493 |
fn=make3d,
|
| 494 |
inputs=[mv_images],
|
| 495 |
+
outputs=[output_model_obj, output_model_glb]
|
| 496 |
+
# outputs=[output_video, output_model_obj, output_model_glb]
|
| 497 |
)
|
| 498 |
|
| 499 |
# demo.queue(max_size=10)
|