christinac commited on
Commit
9b24bad
·
1 Parent(s): 3846533

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -16,11 +16,11 @@ pipe.to(device)
16
 
17
  #draw an image based off of user's text input
18
 
19
- def drawImage(text, prompt, strength, guidance_scale): #(text, text_size, 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
 
@@ -44,16 +44,16 @@ def drawImage(text, prompt, strength, guidance_scale): #(text, text_size, font)
44
  #demo = gr.Series(drawImage,newImage)
45
 
46
  demo = gr.Interface(
47
- #title="AI text decorator",
48
  #description="christina",
49
  fn=drawImage,
50
  inputs=[
51
  gr.Textbox(placeholder="shift + enter for new line",label="what do you want to say?"),
52
  #"file"
53
- #gr.Number(value=int(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()
 
16
 
17
  #draw an image based off of user's text input
18
 
19
+ def drawImage(text, text_size, prompt, strength, guidance_scale): #(text, text_size, 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, int(text_size))
24
  d = ImageDraw.Draw(out)
25
  d.multiline_text((16, 64), text, font=fnt, fill=(255, 255, 255))
26
 
 
44
  #demo = gr.Series(drawImage,newImage)
45
 
46
  demo = gr.Interface(
47
+ title="if you're trying this, take a screenshot and send it to me! shift + command + 3 on mac",
48
  #description="christina",
49
  fn=drawImage,
50
  inputs=[
51
  gr.Textbox(placeholder="shift + enter for new line",label="what do you want to say?"),
52
  #"file"
53
+ gr.Number(label="text size",value=240),
54
+ gr.Textbox(placeholder="eg. imagery, art style, materials, emotions",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=15, maximum=20),
57
  ],
58
  outputs="image")
59
  demo.launch()