christinac commited on
Commit
d40b2a7
·
1 Parent(s): 291126e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
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, 240)
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=0.7, guidance_scale=7).images
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.Textbox(placeholder="prompt",label="how does your message look and feel?") #figure out models in series
 
 
 
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()