Update app.py
Browse files
app.py
CHANGED
|
@@ -8,6 +8,7 @@
|
|
| 8 |
|
| 9 |
# Detailed Interface
|
| 10 |
|
|
|
|
| 11 |
import gradio as gr
|
| 12 |
#from transformers import pipeline
|
| 13 |
#from diffusers import StableDiffusionImg2ImgPipeline
|
|
@@ -16,14 +17,16 @@ import torch
|
|
| 16 |
from diffusers import StableDiffusionPipeline
|
| 17 |
|
| 18 |
pipe = StableDiffusionPipeline.from_pretrained("mswhite/miamivice") #, torch_dtype=torch.float16)
|
| 19 |
-
|
| 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 |
-
|
|
|
|
|
|
|
| 27 |
|
| 28 |
def clear(text):
|
| 29 |
return gr.Image.update()
|
|
@@ -31,7 +34,8 @@ def clear(text):
|
|
| 31 |
with gr.Blocks() as demo:
|
| 32 |
|
| 33 |
with gr.Row():
|
| 34 |
-
gr.
|
|
|
|
| 35 |
output = gr.Image(label="Output").style(width=720)
|
| 36 |
with gr.Row():
|
| 37 |
art_to_draw = gr.Textbox(label="Art to Draw")
|
|
|
|
| 8 |
|
| 9 |
# Detailed Interface
|
| 10 |
|
| 11 |
+
import os
|
| 12 |
import gradio as gr
|
| 13 |
#from transformers import pipeline
|
| 14 |
#from diffusers import StableDiffusionImg2ImgPipeline
|
|
|
|
| 17 |
from diffusers import StableDiffusionPipeline
|
| 18 |
|
| 19 |
pipe = StableDiffusionPipeline.from_pretrained("mswhite/miamivice") #, torch_dtype=torch.float16)
|
| 20 |
+
pipe = pipe.to("cuda")
|
| 21 |
|
| 22 |
#prompt = "a photo of an astronaut riding a horse on mars"
|
| 23 |
#image = pipe(prompt).images[0]
|
| 24 |
#pipe = pipeline("text-to-image", model="mswhite/miamivice")
|
| 25 |
|
| 26 |
def nagelize(text):
|
| 27 |
+
prompt = "p_nagel illustration of " + text
|
| 28 |
+
print(prompt)
|
| 29 |
+
return pipe(prompt)[0]["image"]
|
| 30 |
|
| 31 |
def clear(text):
|
| 32 |
return gr.Image.update()
|
|
|
|
| 34 |
with gr.Blocks() as demo:
|
| 35 |
|
| 36 |
with gr.Row():
|
| 37 |
+
logo_image = gr.Image(label = None, value = os.path.join(os.path.dirname(__file__), "miami.jpg")).style(width=720)
|
| 38 |
+
#gr.Markdown("<img src=https://huggingface.co/spaces/mswhite/miamivice/resolve/main/miami.jpg width=720px>")
|
| 39 |
output = gr.Image(label="Output").style(width=720)
|
| 40 |
with gr.Row():
|
| 41 |
art_to_draw = gr.Textbox(label="Art to Draw")
|