Update app.py
Browse files
app.py
CHANGED
|
@@ -28,23 +28,23 @@ def generate_image_sd(prompt: str, negative_prompt: str, guidance_scale: float,
|
|
| 28 |
print(f"Image generated in {end_time - start_time:.2f} seconds.")
|
| 29 |
return image
|
| 30 |
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
fn=generate_image_sd,
|
| 45 |
inputs=[prompt, neg_prompt, guidance, steps],
|
| 46 |
outputs=output_image
|
| 47 |
-
|
| 48 |
|
| 49 |
if __name__ == "__main__":
|
| 50 |
if not image_generator_pipe:
|
|
|
|
| 28 |
print(f"Image generated in {end_time - start_time:.2f} seconds.")
|
| 29 |
return image
|
| 30 |
|
| 31 |
+
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
| 32 |
+
with gr.Row():
|
| 33 |
+
with gr.Column(scale=1):
|
| 34 |
+
prompt = gr.Textbox(label="Prompt", placeholder="A beautiful futuristic city skyline at night")
|
| 35 |
+
neg_prompt = gr.Textbox(label="Negative Prompt", placeholder="blurry, distorted, watermark")
|
| 36 |
+
guidance = gr.Slider(1.0, 15.0, value=7.5, step=0.5, label="Guidance Scale")
|
| 37 |
+
steps = gr.Slider(10, 50, value=25, step=1, label="Inference Steps")
|
| 38 |
+
generate_btn = gr.Button("Generate Image")
|
| 39 |
+
|
| 40 |
+
with gr.Column(scale=1):
|
| 41 |
+
output_image = gr.Image(label="Generated Image", type="pil")
|
| 42 |
+
|
| 43 |
+
generate_btn.click(
|
| 44 |
fn=generate_image_sd,
|
| 45 |
inputs=[prompt, neg_prompt, guidance, steps],
|
| 46 |
outputs=output_image
|
| 47 |
+
)
|
| 48 |
|
| 49 |
if __name__ == "__main__":
|
| 50 |
if not image_generator_pipe:
|