Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
|
@@ -11,7 +11,7 @@ def apply_patches():
|
|
| 11 |
|
| 12 |
# 1. Fix tqdm Jupyter/Thread Error
|
| 13 |
try:
|
| 14 |
-
import tqdm
|
| 15 |
if not hasattr(tqdm, '_is_patched'):
|
| 16 |
import tqdm.notebook
|
| 17 |
import tqdm.std
|
|
@@ -121,8 +121,8 @@ def custom_sampling_loop(prompt, pipe, guidance_scale=7.5, contrast_scale=0.0, c
|
|
| 121 |
latents = torch.randn((num_images, pipe.unet.config.in_channels, 512 // 8, 512 // 8), generator=generator, device=device, dtype=dtype)
|
| 122 |
pipe.scheduler.set_timesteps(num_inference_steps)
|
| 123 |
latents = latents * pipe.scheduler.init_noise_sigma
|
| 124 |
-
import tqdm
|
| 125 |
-
for t in tqdm
|
| 126 |
latent_model_input = torch.cat([latents] * 2)
|
| 127 |
latent_model_input = pipe.scheduler.scale_model_input(latent_model_input, t)
|
| 128 |
with torch.no_grad():
|
|
@@ -284,7 +284,8 @@ def generate_all_styles(prompt, seed1, seed2, seed3, seed4, seed5, seed6, num_in
|
|
| 284 |
return all_images[0], all_images[1], all_images[2], all_images[3], all_images[4], all_images[5], "\n\n---\n\n".join(info_texts)
|
| 285 |
|
| 286 |
# Create Gradio interface
|
| 287 |
-
with gr.Blocks(title="Stable Diffusion Style Explorer"
|
|
|
|
| 288 |
gr.Markdown("""
|
| 289 |
# 🎨 Stable Diffusion Style Explorer
|
| 290 |
|
|
@@ -540,13 +541,7 @@ with gr.Blocks(title="Stable Diffusion Style Explorer", theme=gr.themes.Soft())
|
|
| 540 |
|
| 541 |
|
| 542 |
|
| 543 |
-
# Launch the app
|
| 544 |
if __name__ == "__main__":
|
| 545 |
-
|
| 546 |
-
|
| 547 |
-
def disable_api_info(*args, **kwargs):
|
| 548 |
-
return {}
|
| 549 |
|
| 550 |
-
gradio.routes.get_api_info = disable_api_info
|
| 551 |
-
|
| 552 |
-
demo.launch(server_name="0.0.0.0", server_port=7860)
|
|
|
|
| 11 |
|
| 12 |
# 1. Fix tqdm Jupyter/Thread Error
|
| 13 |
try:
|
| 14 |
+
from tqdm.auto import tqdm
|
| 15 |
if not hasattr(tqdm, '_is_patched'):
|
| 16 |
import tqdm.notebook
|
| 17 |
import tqdm.std
|
|
|
|
| 121 |
latents = torch.randn((num_images, pipe.unet.config.in_channels, 512 // 8, 512 // 8), generator=generator, device=device, dtype=dtype)
|
| 122 |
pipe.scheduler.set_timesteps(num_inference_steps)
|
| 123 |
latents = latents * pipe.scheduler.init_noise_sigma
|
| 124 |
+
from tqdm.auto import tqdm
|
| 125 |
+
for t in tqdm(pipe.scheduler.timesteps):
|
| 126 |
latent_model_input = torch.cat([latents] * 2)
|
| 127 |
latent_model_input = pipe.scheduler.scale_model_input(latent_model_input, t)
|
| 128 |
with torch.no_grad():
|
|
|
|
| 284 |
return all_images[0], all_images[1], all_images[2], all_images[3], all_images[4], all_images[5], "\n\n---\n\n".join(info_texts)
|
| 285 |
|
| 286 |
# Create Gradio interface
|
| 287 |
+
with gr.Blocks(title="Stable Diffusion Style Explorer") as demo:
|
| 288 |
+
|
| 289 |
gr.Markdown("""
|
| 290 |
# 🎨 Stable Diffusion Style Explorer
|
| 291 |
|
|
|
|
| 541 |
|
| 542 |
|
| 543 |
|
|
|
|
| 544 |
if __name__ == "__main__":
|
| 545 |
+
demo.launch(server_name="0.0.0.0", server_port=7860,
|
| 546 |
+
theme=gr.themes.Soft())
|
|
|
|
|
|
|
| 547 |
|
|
|
|
|
|
|
|
|