Spaces:
Runtime error
Runtime error
Commit
·
d40b2a7
1
Parent(s):
291126e
Update app.py
Browse files
app.py
CHANGED
@@ -16,18 +16,18 @@ pipe.to(device)
|
|
16 |
|
17 |
#draw an image based off of user's text input
|
18 |
|
19 |
-
def drawImage(text, prompt): #(text, font)
|
20 |
out = Image.new("RGB", (512, 512), (0, 0, 0))
|
21 |
#add some code here to move font to font-directory
|
22 |
font = './font-directory/DimpleSans-Regular.otf'
|
23 |
-
fnt = ImageFont.truetype(font,
|
24 |
d = ImageDraw.Draw(out)
|
25 |
d.multiline_text((16, 64), text, font=fnt, fill=(255, 255, 255))
|
26 |
|
27 |
#init_image = out
|
28 |
out.save('initImage.png')
|
29 |
images = []
|
30 |
-
images = pipe(prompt=prompt, init_image=out, strength=
|
31 |
#images[0].save = ("image.png")
|
32 |
#images = []
|
33 |
#images.append(out)
|
@@ -50,7 +50,10 @@ demo = gr.Interface(
|
|
50 |
inputs=[
|
51 |
gr.Textbox(placeholder="shift + enter for new line",label="what do you want to say?"),
|
52 |
#"file"
|
53 |
-
gr.
|
|
|
|
|
|
|
54 |
],
|
55 |
outputs="image")
|
56 |
demo.launch()
|
|
|
16 |
|
17 |
#draw an image based off of user's text input
|
18 |
|
19 |
+
def drawImage(text, textsize, prompt, strength, guidance_scale): #(text, font)
|
20 |
out = Image.new("RGB", (512, 512), (0, 0, 0))
|
21 |
#add some code here to move font to font-directory
|
22 |
font = './font-directory/DimpleSans-Regular.otf'
|
23 |
+
fnt = ImageFont.truetype(font, textsize)
|
24 |
d = ImageDraw.Draw(out)
|
25 |
d.multiline_text((16, 64), text, font=fnt, fill=(255, 255, 255))
|
26 |
|
27 |
#init_image = out
|
28 |
out.save('initImage.png')
|
29 |
images = []
|
30 |
+
images = pipe(prompt=prompt, init_image=out, strength=strength, guidance_scale=guidance_scale).images
|
31 |
#images[0].save = ("image.png")
|
32 |
#images = []
|
33 |
#images.append(out)
|
|
|
50 |
inputs=[
|
51 |
gr.Textbox(placeholder="shift + enter for new line",label="what do you want to say?"),
|
52 |
#"file"
|
53 |
+
gr.Number(value=240),
|
54 |
+
gr.Textbox(placeholder="enter prompt",label="how does your message look and feel?"), #figure out models in series
|
55 |
+
gr.Slider(label="strength", placeholder="controls the amount of noise that is added to the input image",minimum=0, maximum=1, step=0.01, value=0.7),
|
56 |
+
gr.Slider(label="guidance scale", placeholder="controls how much the image generation process follows the text prompt",value=7.5, maximum=20),
|
57 |
],
|
58 |
outputs="image")
|
59 |
demo.launch()
|