Spaces:
Running
on
Zero
Running
on
Zero
fix ismultiimage bug
Browse files
app.py
CHANGED
@@ -111,7 +111,7 @@ def get_seed(randomize_seed: bool, seed: int) -> int:
|
|
111 |
def image_to_3d(
|
112 |
image: Image.Image,
|
113 |
multiimages: List[Tuple[Image.Image, str]],
|
114 |
-
is_multiimage:
|
115 |
seed: int,
|
116 |
ss_guidance_strength: float,
|
117 |
ss_sampling_steps: int,
|
@@ -126,7 +126,7 @@ def image_to_3d(
|
|
126 |
Args:
|
127 |
image (Image.Image): The input image for single-image mode.
|
128 |
multiimages (List[Tuple[Image.Image, str]]): List of images with captions for multi-image mode.
|
129 |
-
is_multiimage (
|
130 |
seed (int): Random seed for reproducibility.
|
131 |
ss_guidance_strength (float): Sparse structure guidance strength.
|
132 |
ss_sampling_steps (int): Sparse structure sampling steps.
|
@@ -141,6 +141,7 @@ def image_to_3d(
|
|
141 |
"""
|
142 |
user_dir = os.path.join(TMP_DIR, str(req.session_hash))
|
143 |
os.makedirs(user_dir, exist_ok=True)
|
|
|
144 |
|
145 |
# Run pipeline depending on mode
|
146 |
if not is_multiimage:
|
@@ -269,7 +270,7 @@ def split_image(image: Image.Image) -> List[Image.Image]:
|
|
269 |
def quick_generate_glb(
|
270 |
image: Image.Image,
|
271 |
multiimages: List[Tuple[Image.Image, str]],
|
272 |
-
is_multiimage:
|
273 |
seed: int,
|
274 |
ss_guidance_strength: float,
|
275 |
ss_sampling_steps: int,
|
@@ -299,7 +300,7 @@ def quick_generate_glb(
|
|
299 |
def quick_generate_gs(
|
300 |
image: Image.Image,
|
301 |
multiimages: List[Tuple[Image.Image, str]],
|
302 |
-
is_multiimage:
|
303 |
seed: int,
|
304 |
ss_guidance_strength: float,
|
305 |
ss_sampling_steps: int,
|
@@ -333,7 +334,7 @@ def test_for_api_gen(image: Image.Image) -> Image.Image:
|
|
333 |
Image.Image: The preprocessed image no processs.
|
334 |
"""
|
335 |
return image
|
336 |
-
|
337 |
|
338 |
|
339 |
with gr.Blocks(delete_cache=(600, 600)) as demo:
|
@@ -374,6 +375,12 @@ with gr.Blocks(delete_cache=(600, 600)) as demo:
|
|
374 |
*NOTE: this is an experimental algorithm without training a specialized model. It may not produce the best results for all images, especially those having different poses or inconsistent details.*
|
375 |
""")
|
376 |
|
|
|
|
|
|
|
|
|
|
|
|
|
377 |
with gr.Accordion(label="Generation Settings", open=False):
|
378 |
seed = gr.Slider(0, MAX_SEED, label="Seed", value=0, step=1)
|
379 |
randomize_seed = gr.Checkbox(label="Randomize Seed", value=True)
|
|
|
111 |
def image_to_3d(
|
112 |
image: Image.Image,
|
113 |
multiimages: List[Tuple[Image.Image, str]],
|
114 |
+
is_multiimage: str,
|
115 |
seed: int,
|
116 |
ss_guidance_strength: float,
|
117 |
ss_sampling_steps: int,
|
|
|
126 |
Args:
|
127 |
image (Image.Image): The input image for single-image mode.
|
128 |
multiimages (List[Tuple[Image.Image, str]]): List of images with captions for multi-image mode.
|
129 |
+
is_multiimage (str): Whether to use multi-image generation.
|
130 |
seed (int): Random seed for reproducibility.
|
131 |
ss_guidance_strength (float): Sparse structure guidance strength.
|
132 |
ss_sampling_steps (int): Sparse structure sampling steps.
|
|
|
141 |
"""
|
142 |
user_dir = os.path.join(TMP_DIR, str(req.session_hash))
|
143 |
os.makedirs(user_dir, exist_ok=True)
|
144 |
+
is_multiimage = is_multiimage.lower() == "true"
|
145 |
|
146 |
# Run pipeline depending on mode
|
147 |
if not is_multiimage:
|
|
|
270 |
def quick_generate_glb(
|
271 |
image: Image.Image,
|
272 |
multiimages: List[Tuple[Image.Image, str]],
|
273 |
+
is_multiimage: str,
|
274 |
seed: int,
|
275 |
ss_guidance_strength: float,
|
276 |
ss_sampling_steps: int,
|
|
|
300 |
def quick_generate_gs(
|
301 |
image: Image.Image,
|
302 |
multiimages: List[Tuple[Image.Image, str]],
|
303 |
+
is_multiimage: str,
|
304 |
seed: int,
|
305 |
ss_guidance_strength: float,
|
306 |
ss_sampling_steps: int,
|
|
|
334 |
Image.Image: The preprocessed image no processs.
|
335 |
"""
|
336 |
return image
|
337 |
+
|
338 |
|
339 |
|
340 |
with gr.Blocks(delete_cache=(600, 600)) as demo:
|
|
|
375 |
*NOTE: this is an experimental algorithm without training a specialized model. It may not produce the best results for all images, especially those having different poses or inconsistent details.*
|
376 |
""")
|
377 |
|
378 |
+
is_multiimage = gr.Radio(choices=["true", "false"],value="false",label="Use multi-image mode",visible=True)
|
379 |
+
def update_is_multiimage(tab_index: int):
|
380 |
+
return "true" if tab_index == 1 else "false"
|
381 |
+
input_tabs.select(fn=update_is_multiimage,inputs=None,outputs=is_multiimage)
|
382 |
+
|
383 |
+
|
384 |
with gr.Accordion(label="Generation Settings", open=False):
|
385 |
seed = gr.Slider(0, MAX_SEED, label="Seed", value=0, step=1)
|
386 |
randomize_seed = gr.Checkbox(label="Randomize Seed", value=True)
|