Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -90,12 +90,12 @@ def generate_flux_image(
|
|
90 |
guidance_scale: float,
|
91 |
req: gr.Request,
|
92 |
progress: gr.Progress = gr.Progress(track_tqdm=True),
|
93 |
-
) ->
|
94 |
"""Generate image using Flux pipeline"""
|
95 |
if randomize_seed:
|
96 |
seed = random.randint(0, MAX_SEED)
|
97 |
generator = torch.Generator(device=device).manual_seed(seed)
|
98 |
-
prompt = "wbgmsst, " + prompt + ", 3D isometric,
|
99 |
image = flux_pipeline(
|
100 |
prompt=prompt,
|
101 |
guidance_scale=guidance_scale,
|
@@ -114,7 +114,6 @@ def generate_flux_image(
|
|
114 |
filename = f"{timestamp}_{unique_id}.png"
|
115 |
filepath = os.path.join(user_dir, filename)
|
116 |
image.save(filepath)
|
117 |
-
print(f"Imagen guardada en: {filepath}")
|
118 |
|
119 |
return image
|
120 |
|
@@ -252,10 +251,6 @@ with gr.Blocks() as demo:
|
|
252 |
get_seed,
|
253 |
inputs=[randomize_seed, seed],
|
254 |
outputs=[seed],
|
255 |
-
).then(
|
256 |
-
preprocess_image,
|
257 |
-
inputs=[generated_image],
|
258 |
-
outputs=[generated_image],
|
259 |
).then(
|
260 |
image_to_3d,
|
261 |
inputs=[
|
@@ -272,6 +267,11 @@ with gr.Blocks() as demo:
|
|
272 |
outputs=[extract_glb_btn, extract_gs_btn],
|
273 |
)
|
274 |
|
|
|
|
|
|
|
|
|
|
|
275 |
# Extraer GLB
|
276 |
extract_glb_btn.click(
|
277 |
extract_glb,
|
@@ -291,6 +291,11 @@ with gr.Blocks() as demo:
|
|
291 |
lambda: gr.Button(interactive=True),
|
292 |
outputs=[download_gs],
|
293 |
)
|
|
|
|
|
|
|
|
|
|
|
294 |
|
295 |
# Initialize both pipelines
|
296 |
if __name__ == "__main__":
|
|
|
90 |
guidance_scale: float,
|
91 |
req: gr.Request,
|
92 |
progress: gr.Progress = gr.Progress(track_tqdm=True),
|
93 |
+
) -> Image.Image:
|
94 |
"""Generate image using Flux pipeline"""
|
95 |
if randomize_seed:
|
96 |
seed = random.randint(0, MAX_SEED)
|
97 |
generator = torch.Generator(device=device).manual_seed(seed)
|
98 |
+
prompt = "wbgmsst, " + prompt + ", 3D isometric, black background"
|
99 |
image = flux_pipeline(
|
100 |
prompt=prompt,
|
101 |
guidance_scale=guidance_scale,
|
|
|
114 |
filename = f"{timestamp}_{unique_id}.png"
|
115 |
filepath = os.path.join(user_dir, filename)
|
116 |
image.save(filepath)
|
|
|
117 |
|
118 |
return image
|
119 |
|
|
|
251 |
get_seed,
|
252 |
inputs=[randomize_seed, seed],
|
253 |
outputs=[seed],
|
|
|
|
|
|
|
|
|
254 |
).then(
|
255 |
image_to_3d,
|
256 |
inputs=[
|
|
|
267 |
outputs=[extract_glb_btn, extract_gs_btn],
|
268 |
)
|
269 |
|
270 |
+
video_output.clear(
|
271 |
+
lambda: tuple([gr.Button(interactive=False), gr.Button(interactive=False)]),
|
272 |
+
outputs=[extract_glb_btn, extract_gs_btn],
|
273 |
+
)
|
274 |
+
|
275 |
# Extraer GLB
|
276 |
extract_glb_btn.click(
|
277 |
extract_glb,
|
|
|
291 |
lambda: gr.Button(interactive=True),
|
292 |
outputs=[download_gs],
|
293 |
)
|
294 |
+
|
295 |
+
model_output.clear(
|
296 |
+
lambda: gr.Button(interactive=False),
|
297 |
+
outputs=[download_glb],
|
298 |
+
)
|
299 |
|
300 |
# Initialize both pipelines
|
301 |
if __name__ == "__main__":
|