Update app.py
Browse files
app.py
CHANGED
|
@@ -14,14 +14,14 @@ from previewer.modules import Previewer
|
|
| 14 |
os.environ['TOKENIZERS_PARALLELISM'] = 'false'
|
| 15 |
|
| 16 |
DESCRIPTION = "# Stable Cascade"
|
| 17 |
-
DESCRIPTION += "\n<p style=\"text-align: center\">Unofficial demo Modified by <a href='https://www.youtube.com/@Aitrepreneur/' target='_blank'>Aitrepreneur</a> for <a href='https://huggingface.co/stabilityai/stable-cascade' target='_blank'>Stable Cascade</a>, a new high resolution text-to-image model by Stability AI, built on the Würstchen architecture - <a href='https://huggingface.co/stabilityai/stable-cascade/blob/main/LICENSE' target='_blank'>non-commercial research license</a></p>"
|
| 18 |
|
| 19 |
MAX_SEED = np.iinfo(np.int32).max
|
| 20 |
CACHE_EXAMPLES = False
|
| 21 |
MAX_IMAGE_SIZE = int(os.getenv("MAX_IMAGE_SIZE", "1536"))
|
| 22 |
USE_TORCH_COMPILE = False
|
| 23 |
ENABLE_CPU_OFFLOAD = os.getenv("ENABLE_CPU_OFFLOAD") == "1"
|
| 24 |
-
PREVIEW_IMAGES =
|
| 25 |
|
| 26 |
parser = argparse.ArgumentParser(description='Gradio App Control')
|
| 27 |
parser.add_argument('--share', action='store_true', help='Create a public shareable URL')
|
|
@@ -91,7 +91,7 @@ def generate(
|
|
| 91 |
num_images_per_prompt: int = 2,
|
| 92 |
# profile: gr.OAuthProfile | None = None,
|
| 93 |
) -> PIL.Image.Image:
|
| 94 |
-
previewer.eval().requires_grad_(False).to(device).to(dtype)
|
| 95 |
prior_pipeline.to(device)
|
| 96 |
decoder_pipeline.to(device)
|
| 97 |
|
|
@@ -106,8 +106,8 @@ def generate(
|
|
| 106 |
guidance_scale=prior_guidance_scale,
|
| 107 |
num_images_per_prompt=num_images_per_prompt,
|
| 108 |
generator=generator,
|
| 109 |
-
callback=callback_prior,
|
| 110 |
-
callback_steps=callback_steps
|
| 111 |
)
|
| 112 |
|
| 113 |
if PREVIEW_IMAGES:
|
|
@@ -270,4 +270,4 @@ if __name__ == "__main__":
|
|
| 270 |
'share': args.share,
|
| 271 |
'server_port' : args.server_port,
|
| 272 |
}
|
| 273 |
-
demo_with_history.launch(**launch_args)
|
|
|
|
| 14 |
os.environ['TOKENIZERS_PARALLELISM'] = 'false'
|
| 15 |
|
| 16 |
DESCRIPTION = "# Stable Cascade"
|
| 17 |
+
DESCRIPTION += "\n<p style=\"text-align: center\">Unofficial V2 demo Modified by <a href='https://www.youtube.com/@Aitrepreneur/' target='_blank'>Aitrepreneur</a> for <a href='https://huggingface.co/stabilityai/stable-cascade' target='_blank'>Stable Cascade</a>, a new high resolution text-to-image model by Stability AI, built on the Würstchen architecture - <a href='https://huggingface.co/stabilityai/stable-cascade/blob/main/LICENSE' target='_blank'>non-commercial research license</a></p>"
|
| 18 |
|
| 19 |
MAX_SEED = np.iinfo(np.int32).max
|
| 20 |
CACHE_EXAMPLES = False
|
| 21 |
MAX_IMAGE_SIZE = int(os.getenv("MAX_IMAGE_SIZE", "1536"))
|
| 22 |
USE_TORCH_COMPILE = False
|
| 23 |
ENABLE_CPU_OFFLOAD = os.getenv("ENABLE_CPU_OFFLOAD") == "1"
|
| 24 |
+
PREVIEW_IMAGES = False
|
| 25 |
|
| 26 |
parser = argparse.ArgumentParser(description='Gradio App Control')
|
| 27 |
parser.add_argument('--share', action='store_true', help='Create a public shareable URL')
|
|
|
|
| 91 |
num_images_per_prompt: int = 2,
|
| 92 |
# profile: gr.OAuthProfile | None = None,
|
| 93 |
) -> PIL.Image.Image:
|
| 94 |
+
#previewer.eval().requires_grad_(False).to(device).to(dtype)
|
| 95 |
prior_pipeline.to(device)
|
| 96 |
decoder_pipeline.to(device)
|
| 97 |
|
|
|
|
| 106 |
guidance_scale=prior_guidance_scale,
|
| 107 |
num_images_per_prompt=num_images_per_prompt,
|
| 108 |
generator=generator,
|
| 109 |
+
#callback=callback_prior,
|
| 110 |
+
#callback_steps=callback_steps
|
| 111 |
)
|
| 112 |
|
| 113 |
if PREVIEW_IMAGES:
|
|
|
|
| 270 |
'share': args.share,
|
| 271 |
'server_port' : args.server_port,
|
| 272 |
}
|
| 273 |
+
demo_with_history.launch(**launch_args)
|