Update app.py
Browse files
app.py
CHANGED
|
@@ -12,6 +12,11 @@ pipe = StableDiffusionPipeline.from_pretrained(
|
|
| 12 |
model_id,
|
| 13 |
torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32,
|
| 14 |
scheduler=scheduler)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
pipe_i2i = StableDiffusionImg2ImgPipeline.from_pretrained(
|
| 17 |
model_id,
|
|
@@ -74,7 +79,7 @@ def txt_to_img(prompt, neg_prompt, guidance, steps, width, height, generator):
|
|
| 74 |
height = height,
|
| 75 |
generator = generator)
|
| 76 |
|
| 77 |
-
return result.images[0]
|
| 78 |
|
| 79 |
def img_to_img(prompt, neg_prompt, img, strength, guidance, steps, width, height, generator):
|
| 80 |
|
|
@@ -131,10 +136,10 @@ Have Fun & Enjoy
|
|
| 131 |
with gr.Column(scale=55):
|
| 132 |
with gr.Group():
|
| 133 |
with gr.Row():
|
| 134 |
-
prompt = gr.Textbox(label="Prompt", show_label=False,
|
| 135 |
generate = gr.Button(value="Generate").style(rounded=(False, True, True, False))
|
| 136 |
|
| 137 |
-
image_out = gr.Image(height=512)
|
| 138 |
error_output = gr.Markdown()
|
| 139 |
|
| 140 |
with gr.Column(scale=45):
|
|
|
|
| 12 |
model_id,
|
| 13 |
torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32,
|
| 14 |
scheduler=scheduler)
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
pipe = StableDiffusionPipeline.from_pretrained("hakurei/waifu-diffusion", use_auth_token="<mytoken>").to('cuda')
|
| 18 |
+
image = pipe(prompt, safety_checker=None).images[0]
|
| 19 |
+
image.save(f"{prompt}.png")
|
| 20 |
|
| 21 |
pipe_i2i = StableDiffusionImg2ImgPipeline.from_pretrained(
|
| 22 |
model_id,
|
|
|
|
| 79 |
height = height,
|
| 80 |
generator = generator)
|
| 81 |
|
| 82 |
+
return result.imagesimage = pipe(prompt, safety_checker=None).images[0]
|
| 83 |
|
| 84 |
def img_to_img(prompt, neg_prompt, img, strength, guidance, steps, width, height, generator):
|
| 85 |
|
|
|
|
| 136 |
with gr.Column(scale=55):
|
| 137 |
with gr.Group():
|
| 138 |
with gr.Row():
|
| 139 |
+
prompt = gr.Textbox(label="Prompt", show_label=False,max_lines=2,placeholder=f"{prefix} [your prompt]").style(container=False)
|
| 140 |
generate = gr.Button(value="Generate").style(rounded=(False, True, True, False))
|
| 141 |
|
| 142 |
+
image_out = gr.Image(image = pipe (prompt, safety_checker=None) height=512)(f"{prompt}.png")
|
| 143 |
error_output = gr.Markdown()
|
| 144 |
|
| 145 |
with gr.Column(scale=45):
|