Spaces:
Running
on
Zero
Running
on
Zero
xinjie.wang
commited on
Commit
Β·
0732315
1
Parent(s):
2d79b30
update
Browse files- app.py +23 -19
- embodied_gen/models/texture_model.py +1 -1
app.py
CHANGED
|
@@ -50,6 +50,8 @@ def active_btn_by_content(mesh_content: gr.Model3D, text_content: gr.Textbox):
|
|
| 50 |
|
| 51 |
|
| 52 |
with gr.Blocks(delete_cache=(43200, 43200), theme=custom_theme) as demo:
|
|
|
|
|
|
|
| 53 |
gr.Markdown(
|
| 54 |
"""
|
| 55 |
## ***EmbodiedGen***: Texture Generation
|
|
@@ -64,30 +66,33 @@ with gr.Blocks(delete_cache=(43200, 43200), theme=custom_theme) as demo:
|
|
| 64 |
<a href="https://github.com/HorizonRobotics/EmbodiedGen">
|
| 65 |
<img alt="π» GitHub" src="https://img.shields.io/badge/GitHub-000000?logo=github">
|
| 66 |
</a>
|
| 67 |
-
<a href="https://www.youtube.com/watch?v=
|
| 68 |
<img alt="π₯ Video" src="https://img.shields.io/badge/π₯-Video-red">
|
| 69 |
</a>
|
| 70 |
</p>
|
| 71 |
|
| 72 |
π¨ Generate visually rich textures for 3D mesh.
|
| 73 |
-
|
| 74 |
""".format(
|
| 75 |
VERSION=VERSION
|
| 76 |
),
|
| 77 |
elem_classes=["header"],
|
| 78 |
)
|
| 79 |
-
|
| 80 |
-
# gr.HTML(lighting_css)
|
| 81 |
with gr.Row():
|
| 82 |
with gr.Column(scale=1):
|
|
|
|
|
|
|
|
|
|
| 83 |
mesh_input = gr.Model3D(
|
| 84 |
-
label="Upload Mesh File(.obj or .glb)", height=
|
| 85 |
)
|
| 86 |
local_mesh = gr.Textbox(visible=False)
|
| 87 |
text_prompt = gr.Textbox(
|
| 88 |
label="Text Prompt (Chinese or English)",
|
| 89 |
placeholder="Input text prompt here",
|
| 90 |
)
|
|
|
|
|
|
|
| 91 |
ip_image = gr.Image(
|
| 92 |
label="Reference Image(optional)",
|
| 93 |
format="png",
|
|
@@ -97,8 +102,8 @@ with gr.Blocks(delete_cache=(43200, 43200), theme=custom_theme) as demo:
|
|
| 97 |
elem_classes=["image_fit"],
|
| 98 |
)
|
| 99 |
gr.Markdown(
|
| 100 |
-
"Note: The `reference image` is optional. If provided,
|
| 101 |
-
"increase
|
| 102 |
)
|
| 103 |
|
| 104 |
with gr.Accordion(label="Generation Settings", open=False):
|
|
@@ -139,12 +144,6 @@ with gr.Blocks(delete_cache=(43200, 43200), theme=custom_theme) as demo:
|
|
| 139 |
512, 2048, label="Video Resolution", value=512, step=256
|
| 140 |
)
|
| 141 |
|
| 142 |
-
generate_mv_btn = gr.Button(
|
| 143 |
-
"π¨ 1. Generate MV Images(~1min)",
|
| 144 |
-
variant="primary",
|
| 145 |
-
interactive=False,
|
| 146 |
-
)
|
| 147 |
-
|
| 148 |
with gr.Column(scale=3):
|
| 149 |
with gr.Row():
|
| 150 |
image_sample1 = gr.Image(
|
|
@@ -194,10 +193,10 @@ with gr.Blocks(delete_cache=(43200, 43200), theme=custom_theme) as demo:
|
|
| 194 |
visible=False,
|
| 195 |
)
|
| 196 |
|
| 197 |
-
gr.Markdown(
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
)
|
| 201 |
with gr.Row():
|
| 202 |
with gr.Column(scale=1):
|
| 203 |
with gr.Row():
|
|
@@ -222,6 +221,11 @@ with gr.Blocks(delete_cache=(43200, 43200), theme=custom_theme) as demo:
|
|
| 222 |
)
|
| 223 |
|
| 224 |
with gr.Column(scale=1):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 225 |
texture_bake_btn = gr.Button(
|
| 226 |
"π οΈ 2. Texture Baking(~2min)",
|
| 227 |
variant="primary",
|
|
@@ -237,7 +241,7 @@ with gr.Blocks(delete_cache=(43200, 43200), theme=custom_theme) as demo:
|
|
| 237 |
mesh_output = gr.Model3D(
|
| 238 |
label="Mesh Edit Result",
|
| 239 |
clear_color=[0.8, 0.8, 0.8, 1],
|
| 240 |
-
height=
|
| 241 |
interactive=False,
|
| 242 |
elem_id="lighter_mesh",
|
| 243 |
)
|
|
@@ -246,7 +250,7 @@ with gr.Blocks(delete_cache=(43200, 43200), theme=custom_theme) as demo:
|
|
| 246 |
label="Mesh Edit Video",
|
| 247 |
autoplay=True,
|
| 248 |
loop=True,
|
| 249 |
-
height=
|
| 250 |
)
|
| 251 |
|
| 252 |
with gr.Row():
|
|
|
|
| 50 |
|
| 51 |
|
| 52 |
with gr.Blocks(delete_cache=(43200, 43200), theme=custom_theme) as demo:
|
| 53 |
+
gr.HTML(image_css, visible=False)
|
| 54 |
+
# gr.HTML(lighting_css, visible=False)
|
| 55 |
gr.Markdown(
|
| 56 |
"""
|
| 57 |
## ***EmbodiedGen***: Texture Generation
|
|
|
|
| 66 |
<a href="https://github.com/HorizonRobotics/EmbodiedGen">
|
| 67 |
<img alt="π» GitHub" src="https://img.shields.io/badge/GitHub-000000?logo=github">
|
| 68 |
</a>
|
| 69 |
+
<a href="https://www.youtube.com/watch?v=rG4odybuJRk">
|
| 70 |
<img alt="π₯ Video" src="https://img.shields.io/badge/π₯-Video-red">
|
| 71 |
</a>
|
| 72 |
</p>
|
| 73 |
|
| 74 |
π¨ Generate visually rich textures for 3D mesh.
|
|
|
|
| 75 |
""".format(
|
| 76 |
VERSION=VERSION
|
| 77 |
),
|
| 78 |
elem_classes=["header"],
|
| 79 |
)
|
| 80 |
+
|
|
|
|
| 81 |
with gr.Row():
|
| 82 |
with gr.Column(scale=1):
|
| 83 |
+
gr.Markdown(
|
| 84 |
+
"You can select input in `Mesh Gallery` at page bottom."
|
| 85 |
+
)
|
| 86 |
mesh_input = gr.Model3D(
|
| 87 |
+
label="Upload Mesh File(.obj or .glb)", height=270
|
| 88 |
)
|
| 89 |
local_mesh = gr.Textbox(visible=False)
|
| 90 |
text_prompt = gr.Textbox(
|
| 91 |
label="Text Prompt (Chinese or English)",
|
| 92 |
placeholder="Input text prompt here",
|
| 93 |
)
|
| 94 |
+
gr.Markdown("<br>")
|
| 95 |
+
|
| 96 |
ip_image = gr.Image(
|
| 97 |
label="Reference Image(optional)",
|
| 98 |
format="png",
|
|
|
|
| 102 |
elem_classes=["image_fit"],
|
| 103 |
)
|
| 104 |
gr.Markdown(
|
| 105 |
+
"Note: The `reference image` is optional. If provided, "
|
| 106 |
+
"increase `Condition Scale` in Generation Settings."
|
| 107 |
)
|
| 108 |
|
| 109 |
with gr.Accordion(label="Generation Settings", open=False):
|
|
|
|
| 144 |
512, 2048, label="Video Resolution", value=512, step=256
|
| 145 |
)
|
| 146 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 147 |
with gr.Column(scale=3):
|
| 148 |
with gr.Row():
|
| 149 |
image_sample1 = gr.Image(
|
|
|
|
| 193 |
visible=False,
|
| 194 |
)
|
| 195 |
|
| 196 |
+
# gr.Markdown(
|
| 197 |
+
# "Note: Select samples with consistent textures from various "
|
| 198 |
+
# "perspectives and no obvious reflections."
|
| 199 |
+
# )
|
| 200 |
with gr.Row():
|
| 201 |
with gr.Column(scale=1):
|
| 202 |
with gr.Row():
|
|
|
|
| 221 |
)
|
| 222 |
|
| 223 |
with gr.Column(scale=1):
|
| 224 |
+
generate_mv_btn = gr.Button(
|
| 225 |
+
"π¨ 1. Generate MV Images(~1min)",
|
| 226 |
+
variant="primary",
|
| 227 |
+
interactive=False,
|
| 228 |
+
)
|
| 229 |
texture_bake_btn = gr.Button(
|
| 230 |
"π οΈ 2. Texture Baking(~2min)",
|
| 231 |
variant="primary",
|
|
|
|
| 241 |
mesh_output = gr.Model3D(
|
| 242 |
label="Mesh Edit Result",
|
| 243 |
clear_color=[0.8, 0.8, 0.8, 1],
|
| 244 |
+
height=340,
|
| 245 |
interactive=False,
|
| 246 |
elem_id="lighter_mesh",
|
| 247 |
)
|
|
|
|
| 250 |
label="Mesh Edit Video",
|
| 251 |
autoplay=True,
|
| 252 |
loop=True,
|
| 253 |
+
height=340,
|
| 254 |
)
|
| 255 |
|
| 256 |
with gr.Row():
|
embodied_gen/models/texture_model.py
CHANGED
|
@@ -60,7 +60,7 @@ def build_texture_gen_pipe(
|
|
| 60 |
)
|
| 61 |
|
| 62 |
if controlnet_ckpt is None:
|
| 63 |
-
suffix = "texture_gen_mv_v1"
|
| 64 |
model_path = snapshot_download(
|
| 65 |
repo_id="xinjjj/RoboAssetGen", allow_patterns=f"{suffix}/*"
|
| 66 |
)
|
|
|
|
| 60 |
)
|
| 61 |
|
| 62 |
if controlnet_ckpt is None:
|
| 63 |
+
suffix = "texture_gen_mv_v1" # "geo_cond_mv"
|
| 64 |
model_path = snapshot_download(
|
| 65 |
repo_id="xinjjj/RoboAssetGen", allow_patterns=f"{suffix}/*"
|
| 66 |
)
|