Paulina commited on
Commit ·
052501f
1
Parent(s): 0f02b50
2.1
Browse files
app.py
CHANGED
|
@@ -31,18 +31,7 @@ def initialize_pipeline():
|
|
| 31 |
|
| 32 |
@spaces.GPU
|
| 33 |
def generate_image(prompt, seed, num_inference_steps):
|
| 34 |
-
|
| 35 |
-
Generate an image using Stable Diffusion.
|
| 36 |
-
This function runs on Zero GPU when deployed on Hugging Face Spaces.
|
| 37 |
-
|
| 38 |
-
Args:
|
| 39 |
-
prompt: Text description of the image to generate
|
| 40 |
-
seed: Random seed for reproducibility
|
| 41 |
-
num_inference_steps: Number of denoising steps
|
| 42 |
-
|
| 43 |
-
Returns:
|
| 44 |
-
PIL Image
|
| 45 |
-
"""
|
| 46 |
# Initialize pipeline
|
| 47 |
pipeline = initialize_pipeline()
|
| 48 |
device = pipeline.device
|
|
@@ -93,15 +82,15 @@ def create_interface():
|
|
| 93 |
gr.Slider(
|
| 94 |
minimum=0,
|
| 95 |
maximum=2147483647,
|
| 96 |
-
|
| 97 |
step=1,
|
| 98 |
label="Seed",
|
| 99 |
info="Random seed for reproducibility",
|
| 100 |
),
|
| 101 |
gr.Slider(
|
| 102 |
minimum=1,
|
| 103 |
-
maximum=
|
| 104 |
-
value=
|
| 105 |
step=1,
|
| 106 |
label="Diffusion Steps",
|
| 107 |
info="Number of denoising steps (more steps = higher quality but slower)",
|
|
@@ -115,8 +104,8 @@ def create_interface():
|
|
| 115 |
description="Generate images from text using Stable Diffusion. Enter a prompt, set the seed for reproducibility, and adjust the number of diffusion steps. Watch the diffusion process as a video.",
|
| 116 |
examples=[
|
| 117 |
["A beautiful sunset over mountains", 42, 50],
|
| 118 |
-
["A cat wearing a space suit, digital art", 123,
|
| 119 |
-
["Cyberpunk city at night, neon lights", 456,
|
| 120 |
],
|
| 121 |
cache_examples=False,
|
| 122 |
)
|
|
|
|
| 31 |
|
| 32 |
@spaces.GPU
|
| 33 |
def generate_image(prompt, seed, num_inference_steps):
|
| 34 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
# Initialize pipeline
|
| 36 |
pipeline = initialize_pipeline()
|
| 37 |
device = pipeline.device
|
|
|
|
| 82 |
gr.Slider(
|
| 83 |
minimum=0,
|
| 84 |
maximum=2147483647,
|
| 85 |
+
randomize=True,
|
| 86 |
step=1,
|
| 87 |
label="Seed",
|
| 88 |
info="Random seed for reproducibility",
|
| 89 |
),
|
| 90 |
gr.Slider(
|
| 91 |
minimum=1,
|
| 92 |
+
maximum=50,
|
| 93 |
+
value=15,
|
| 94 |
step=1,
|
| 95 |
label="Diffusion Steps",
|
| 96 |
info="Number of denoising steps (more steps = higher quality but slower)",
|
|
|
|
| 104 |
description="Generate images from text using Stable Diffusion. Enter a prompt, set the seed for reproducibility, and adjust the number of diffusion steps. Watch the diffusion process as a video.",
|
| 105 |
examples=[
|
| 106 |
["A beautiful sunset over mountains", 42, 50],
|
| 107 |
+
["A cat wearing a space suit, digital art", 123, 20],
|
| 108 |
+
["Cyberpunk city at night, neon lights", 456, 15],
|
| 109 |
],
|
| 110 |
cache_examples=False,
|
| 111 |
)
|