Update app.py
Browse files
app.py
CHANGED
|
@@ -9,13 +9,24 @@
|
|
| 9 |
# Detailed Interface
|
| 10 |
|
| 11 |
import gradio as gr
|
| 12 |
-
from transformers import pipeline
|
|
|
|
| 13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
#pipe = pipeline("text-to-image", model="mswhite/miamivice")
|
| 15 |
|
| 16 |
def nagelize(text):
|
|
|
|
|
|
|
|
|
|
| 17 |
return gr.Image.update()
|
| 18 |
-
# return pipe(text)[0]["image"]
|
| 19 |
|
| 20 |
with gr.Blocks() as demo:
|
| 21 |
|
|
|
|
| 9 |
# Detailed Interface
|
| 10 |
|
| 11 |
import gradio as gr
|
| 12 |
+
#from transformers import pipeline
|
| 13 |
+
#from diffusers import StableDiffusionImg2ImgPipeline
|
| 14 |
|
| 15 |
+
import torch
|
| 16 |
+
from diffusers import StableDiffusionPipeline
|
| 17 |
+
|
| 18 |
+
pipe = StableDiffusionPipeline.from_pretrained("mswhite/miamivice", torch_dtype=torch.float16)
|
| 19 |
+
pipe = pipe.to("cuda")
|
| 20 |
+
|
| 21 |
+
#prompt = "a photo of an astronaut riding a horse on mars"
|
| 22 |
+
#image = pipe(prompt).images[0]
|
| 23 |
#pipe = pipeline("text-to-image", model="mswhite/miamivice")
|
| 24 |
|
| 25 |
def nagelize(text):
|
| 26 |
+
return pipe("p_nagel illustration of " + text)[0]["image"]
|
| 27 |
+
|
| 28 |
+
def clear(text):
|
| 29 |
return gr.Image.update()
|
|
|
|
| 30 |
|
| 31 |
with gr.Blocks() as demo:
|
| 32 |
|