Update app.py
Browse files
app.py
CHANGED
|
@@ -18,17 +18,21 @@ from diffusers import StableDiffusionPipeline, StableDiffusionImg2ImgPipeline
|
|
| 18 |
pipe = StableDiffusionPipeline.from_pretrained("mswhite/miamivice", torch_dtype=torch.float16, safety_checker=None)
|
| 19 |
pipe = pipe.to("cuda")
|
| 20 |
|
|
|
|
|
|
|
|
|
|
| 21 |
# Sample Prompt - "bright clean clear illustration side profile of a woman wearing pink lipstick p_nagel"
|
| 22 |
|
| 23 |
def nagelize(text):
|
| 24 |
prompt = "p_nagel detailed illustration of " + text + " bright solid colors"
|
| 25 |
-
print(prompt)
|
| 26 |
return pipe(prompt).images[0]
|
| 27 |
|
| 28 |
-
def
|
| 29 |
-
prompt = "
|
| 30 |
-
print(prompt)
|
| 31 |
-
return pipe(prompt).images[0]
|
|
|
|
| 32 |
|
| 33 |
with gr.Blocks() as demo:
|
| 34 |
|
|
@@ -38,11 +42,11 @@ with gr.Blocks() as demo:
|
|
| 38 |
output = gr.Image(label="Output").style(width=720)
|
| 39 |
with gr.Row():
|
| 40 |
art_to_draw = gr.Textbox(label="Art to Draw").style(width=720)
|
| 41 |
-
|
| 42 |
-
|
| 43 |
|
| 44 |
-
|
| 45 |
-
|
| 46 |
|
| 47 |
demo.launch()
|
| 48 |
|
|
|
|
| 18 |
pipe = StableDiffusionPipeline.from_pretrained("mswhite/miamivice", torch_dtype=torch.float16, safety_checker=None)
|
| 19 |
pipe = pipe.to("cuda")
|
| 20 |
|
| 21 |
+
pipe_img = StableDiffusionImg2ImgPipeline.from_pretrained("mswhite/miamivice", torch_dtype=torch.float16, safety_checker=None)
|
| 22 |
+
pipe_img = pipe_img.to("cuda")
|
| 23 |
+
|
| 24 |
# Sample Prompt - "bright clean clear illustration side profile of a woman wearing pink lipstick p_nagel"
|
| 25 |
|
| 26 |
def nagelize(text):
|
| 27 |
prompt = "p_nagel detailed illustration of " + text + " bright solid colors"
|
| 28 |
+
#print(prompt)
|
| 29 |
return pipe(prompt).images[0]
|
| 30 |
|
| 31 |
+
def nagelize_me(source_image):
|
| 32 |
+
prompt = "p_nagel detailed illustration using bright solid colors""
|
| 33 |
+
#print(prompt)
|
| 34 |
+
#return pipe(prompt, negative_prompt=negative_prompt, image=source_image, strength=Strength, guidance_scale=guide, num_inference_steps=steps).images[0]
|
| 35 |
+
return pipe_img(prompt, image=source_image).images[0]
|
| 36 |
|
| 37 |
with gr.Blocks() as demo:
|
| 38 |
|
|
|
|
| 42 |
output = gr.Image(label="Output").style(width=720)
|
| 43 |
with gr.Row():
|
| 44 |
art_to_draw = gr.Textbox(label="Art to Draw").style(width=720)
|
| 45 |
+
flashb_btn = gr.Button("Flashback to the 80s")
|
| 46 |
+
back80_btn = gr.Button("Send me back to the 80s")
|
| 47 |
|
| 48 |
+
flashb_btn.click(fn=nagelize, inputs=[art_to_draw], outputs=[output])
|
| 49 |
+
back80_btn.click(fn=nagelize_me, inputs=[logo_image], outputs=[output])
|
| 50 |
|
| 51 |
demo.launch()
|
| 52 |
|