Commit
·
250e7bc
1
Parent(s):
b00a80c
add negative prompts
Browse files
app.py
CHANGED
|
@@ -41,18 +41,19 @@ css = """
|
|
| 41 |
.dark .btn-red:hover {background: linear-gradient(to bottom right, #be123c, #be123c) !important;}
|
| 42 |
"""
|
| 43 |
|
| 44 |
-
def generate(prompt):
|
| 45 |
-
images = pipe(prompt,num_inference_steps=25,guidance_scale=7.5).images
|
| 46 |
return [(img, f"Image {i+1}") for i, img in enumerate(images)]
|
| 47 |
|
| 48 |
|
| 49 |
with gr.Blocks(css=css) as demo:
|
| 50 |
with gr.Column():
|
| 51 |
prompt = gr.Textbox(label="Prompt")
|
|
|
|
| 52 |
submit_btn = gr.Button("Generate", variant="primary", min_width="96px")
|
| 53 |
gallery = gr.Gallery(label="Generated images")
|
| 54 |
|
| 55 |
-
submit_btn.click(generate, [prompt], [gallery], queue=True)
|
| 56 |
|
| 57 |
demo.queue(1)
|
| 58 |
demo.launch(debug=True)
|
|
|
|
| 41 |
.dark .btn-red:hover {background: linear-gradient(to bottom right, #be123c, #be123c) !important;}
|
| 42 |
"""
|
| 43 |
|
| 44 |
+
def generate(prompt, negative_prompt):
|
| 45 |
+
images = pipe(prompts=prompt,neg_prompts=negative_prompt,num_inference_steps=25,guidance_scale=7.5).images
|
| 46 |
return [(img, f"Image {i+1}") for i, img in enumerate(images)]
|
| 47 |
|
| 48 |
|
| 49 |
with gr.Blocks(css=css) as demo:
|
| 50 |
with gr.Column():
|
| 51 |
prompt = gr.Textbox(label="Prompt")
|
| 52 |
+
negative_prompt = gr.Textbox(label="Negative Prompt")
|
| 53 |
submit_btn = gr.Button("Generate", variant="primary", min_width="96px")
|
| 54 |
gallery = gr.Gallery(label="Generated images")
|
| 55 |
|
| 56 |
+
submit_btn.click(generate, [prompt, negative_prompt], [gallery], queue=True)
|
| 57 |
|
| 58 |
demo.queue(1)
|
| 59 |
demo.launch(debug=True)
|