Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -21,11 +21,15 @@ def generate_image(prompt, negative_prompt, seed, randomize_seed, width, height,
|
|
| 21 |
generator = torch.Generator().manual_seed(seed)
|
| 22 |
|
| 23 |
# Load the diffusion pipeline
|
|
|
|
| 24 |
pipe = DiffusionPipeline.from_pretrained("stabilityai/sdxl-turbo", torch_dtype=torch.float16, variant="fp16", use_safetensors=True)
|
| 25 |
pipe.enable_xformers_memory_efficient_attention()
|
| 26 |
pipe = pipe.to(device) # Move the model to the GPU (or CPU if no GPU available)
|
| 27 |
|
|
|
|
|
|
|
| 28 |
# Generate the image
|
|
|
|
| 29 |
image = pipe(
|
| 30 |
prompt=prompt,
|
| 31 |
negative_prompt=negative_prompt,
|
|
@@ -122,15 +126,15 @@ with gr.Blocks(css=css) as demo:
|
|
| 122 |
minimum=0.0,
|
| 123 |
maximum=10.0,
|
| 124 |
step=0.1,
|
| 125 |
-
value=
|
| 126 |
)
|
| 127 |
|
| 128 |
num_inference_steps = gr.Slider(
|
| 129 |
label="Number of inference steps",
|
| 130 |
minimum=1,
|
| 131 |
-
maximum=
|
| 132 |
step=1,
|
| 133 |
-
value=
|
| 134 |
)
|
| 135 |
|
| 136 |
gr.Examples(
|
|
|
|
| 21 |
generator = torch.Generator().manual_seed(seed)
|
| 22 |
|
| 23 |
# Load the diffusion pipeline
|
| 24 |
+
print("Loading model...")
|
| 25 |
pipe = DiffusionPipeline.from_pretrained("stabilityai/sdxl-turbo", torch_dtype=torch.float16, variant="fp16", use_safetensors=True)
|
| 26 |
pipe.enable_xformers_memory_efficient_attention()
|
| 27 |
pipe = pipe.to(device) # Move the model to the GPU (or CPU if no GPU available)
|
| 28 |
|
| 29 |
+
print("Model loaded successfully.")
|
| 30 |
+
|
| 31 |
# Generate the image
|
| 32 |
+
print(f"Generating image with prompt: {prompt}")
|
| 33 |
image = pipe(
|
| 34 |
prompt=prompt,
|
| 35 |
negative_prompt=negative_prompt,
|
|
|
|
| 126 |
minimum=0.0,
|
| 127 |
maximum=10.0,
|
| 128 |
step=0.1,
|
| 129 |
+
value=7.5, # Set a higher value for better image guidance
|
| 130 |
)
|
| 131 |
|
| 132 |
num_inference_steps = gr.Slider(
|
| 133 |
label="Number of inference steps",
|
| 134 |
minimum=1,
|
| 135 |
+
maximum=50,
|
| 136 |
step=1,
|
| 137 |
+
value=25, # Increase the inference steps for better results
|
| 138 |
)
|
| 139 |
|
| 140 |
gr.Examples(
|