christinac commited on
Commit
d5e59e9
1 Parent(s): 2ab9c1f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -11
app.py CHANGED
@@ -1,21 +1,15 @@
1
  from PIL import Image,ImageFont,ImageDraw
2
- import os
3
- import shutil
4
  import gradio as gr
5
  from gradio.mix import Series
6
 
7
  #draw an input image based off of user's text input
8
 
9
- def drawImage(text, font): #add another argument for prompt later
10
  out = Image.new("RGB", (512, 512), (0, 0, 0))
11
  #move font to font-directory
12
- print("font:")
13
- print(str(type(font)))
14
- #print (os.path.abspath(str(type(font))))
15
- srcPath = './app.py' + (str(type(font)))
16
- print(srcPath)
17
- shutil.move(srcPath,'font-directory')
18
-
19
  fnt = ImageFont.truetype(font, 40)
20
  d = ImageDraw.Draw(out)
21
  #d.multiline_text((10, 64), text, fill=(255, 255, 255))
@@ -29,7 +23,7 @@ demo = gr.Interface(
29
  fn=drawImage,
30
  inputs=[
31
  gr.Textbox(placeholder="shift + enter for new line",label="what do you want to say?"),
32
- "file"
33
  #gr.Textbox(placeholder="prompt",label="how does your message look and feel?") #figure out models in series
34
  ],
35
  outputs="image")
 
1
  from PIL import Image,ImageFont,ImageDraw
2
+ #import os
3
+ #import shutil
4
  import gradio as gr
5
  from gradio.mix import Series
6
 
7
  #draw an input image based off of user's text input
8
 
9
+ def drawImage(text): #add another argument for prompt later
10
  out = Image.new("RGB", (512, 512), (0, 0, 0))
11
  #move font to font-directory
12
+ font = './font-directory/DimpleSans-Regular.otf'
 
 
 
 
 
 
13
  fnt = ImageFont.truetype(font, 40)
14
  d = ImageDraw.Draw(out)
15
  #d.multiline_text((10, 64), text, fill=(255, 255, 255))
 
23
  fn=drawImage,
24
  inputs=[
25
  gr.Textbox(placeholder="shift + enter for new line",label="what do you want to say?"),
26
+ #"file"
27
  #gr.Textbox(placeholder="prompt",label="how does your message look and feel?") #figure out models in series
28
  ],
29
  outputs="image")