Spaces:
Running
Running
Commit
·
2e78ab8
1
Parent(s):
db894f7
fix
Browse files
app.py
CHANGED
|
@@ -19,7 +19,7 @@ from trellis.utils import render_utils, postprocessing_utils
|
|
| 19 |
MAX_SEED = np.iinfo(np.int32).max
|
| 20 |
|
| 21 |
|
| 22 |
-
def preprocess_image(image: Image.Image) -> Tuple[np.
|
| 23 |
"""
|
| 24 |
Preprocess the input image.
|
| 25 |
|
|
@@ -184,8 +184,8 @@ with gr.Blocks() as demo:
|
|
| 184 |
model_output = LitModel3D(label="Extracted GLB", exposure=20.0, height=300)
|
| 185 |
download_glb = gr.DownloadButton(label="Download GLB", interactive=False)
|
| 186 |
|
| 187 |
-
|
| 188 |
-
|
| 189 |
|
| 190 |
# Example images at the bottom of the page
|
| 191 |
with gr.Row():
|
|
@@ -196,7 +196,7 @@ with gr.Blocks() as demo:
|
|
| 196 |
],
|
| 197 |
inputs=[image_prompt],
|
| 198 |
fn=lambda image: preprocess_image(image),
|
| 199 |
-
outputs=[
|
| 200 |
run_on_click=True,
|
| 201 |
examples_per_page=64,
|
| 202 |
)
|
|
@@ -205,13 +205,13 @@ with gr.Blocks() as demo:
|
|
| 205 |
image_prompt.upload(
|
| 206 |
preprocess_image,
|
| 207 |
inputs=[image_prompt],
|
| 208 |
-
outputs=[
|
| 209 |
)
|
| 210 |
|
| 211 |
generate_btn.click(
|
| 212 |
image_to_3d,
|
| 213 |
-
inputs=[
|
| 214 |
-
outputs=[
|
| 215 |
).then(
|
| 216 |
activate_button,
|
| 217 |
outputs=[extract_glb_btn],
|
|
@@ -224,7 +224,7 @@ with gr.Blocks() as demo:
|
|
| 224 |
|
| 225 |
extract_glb_btn.click(
|
| 226 |
extract_glb,
|
| 227 |
-
inputs=[
|
| 228 |
outputs=[model_output, download_glb],
|
| 229 |
).then(
|
| 230 |
activate_button,
|
|
|
|
| 19 |
MAX_SEED = np.iinfo(np.int32).max
|
| 20 |
|
| 21 |
|
| 22 |
+
def preprocess_image(image: Image.Image) -> Tuple[np.ndarray, Image.Image]:
|
| 23 |
"""
|
| 24 |
Preprocess the input image.
|
| 25 |
|
|
|
|
| 184 |
model_output = LitModel3D(label="Extracted GLB", exposure=20.0, height=300)
|
| 185 |
download_glb = gr.DownloadButton(label="Download GLB", interactive=False)
|
| 186 |
|
| 187 |
+
image_buf = gr.State()
|
| 188 |
+
output_buf = gr.State()
|
| 189 |
|
| 190 |
# Example images at the bottom of the page
|
| 191 |
with gr.Row():
|
|
|
|
| 196 |
],
|
| 197 |
inputs=[image_prompt],
|
| 198 |
fn=lambda image: preprocess_image(image),
|
| 199 |
+
outputs=[image_buf, image_prompt],
|
| 200 |
run_on_click=True,
|
| 201 |
examples_per_page=64,
|
| 202 |
)
|
|
|
|
| 205 |
image_prompt.upload(
|
| 206 |
preprocess_image,
|
| 207 |
inputs=[image_prompt],
|
| 208 |
+
outputs=[image_buf, image_prompt],
|
| 209 |
)
|
| 210 |
|
| 211 |
generate_btn.click(
|
| 212 |
image_to_3d,
|
| 213 |
+
inputs=[image_buf, seed, randomize_seed, ss_guidance_strength, ss_sampling_steps, slat_guidance_strength, slat_sampling_steps],
|
| 214 |
+
outputs=[output_buf, video_output],
|
| 215 |
).then(
|
| 216 |
activate_button,
|
| 217 |
outputs=[extract_glb_btn],
|
|
|
|
| 224 |
|
| 225 |
extract_glb_btn.click(
|
| 226 |
extract_glb,
|
| 227 |
+
inputs=[output_buf, mesh_simplify, texture_size],
|
| 228 |
outputs=[model_output, download_glb],
|
| 229 |
).then(
|
| 230 |
activate_button,
|