|
|
|
|
|
|
|
|
|
|
|
import os |
|
import spaces |
|
import gradio as gr |
|
import torch |
|
from diffusers import StableDiffusionPipeline, StableDiffusionImg2ImgPipeline |
|
|
|
|
|
|
|
pipe = StableDiffusionPipeline.from_pretrained("mswhite/miamivice", torch_dtype=torch.float16) |
|
pipe = pipe.to("cuda") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@spaces.GPU |
|
def nagelize(text): |
|
prompt = "p_nagel detailed illustration of " + text + " bright solid colors" |
|
return pipe(prompt).images[0] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
with gr.Blocks() as demo: |
|
|
|
gr.Markdown("<img src=https://huggingface.co/spaces/mswhite/miamivice/resolve/main/miami.jpg width=720px>") |
|
output = gr.Image(label="Output", width=720) |
|
art_to_draw = gr.Textbox(label="Prompt to Draw: e.g. woman with red hair") |
|
flashb_btn = gr.Button("Flashback to the 80s") |
|
flashb_btn.click(fn=nagelize, inputs=[art_to_draw], outputs=[output]) |
|
|
|
demo.launch() |
|
|
|
|
|
|