Spaces:
Runtime error
Runtime error
christinac
commited on
Commit
•
bfac29e
1
Parent(s):
2eba66c
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from PIL import Image,ImageFont,ImageDraw
|
2 |
+
import gradio as gr
|
3 |
+
from gradio.mix import Series
|
4 |
+
|
5 |
+
#draw an input image based off of user's text input
|
6 |
+
|
7 |
+
def drawImage(text, font): #add another argument for prompt
|
8 |
+
out = Image.new("RGB", (512, 512), (255, 255, 255))
|
9 |
+
fnt = ImageFont.truetype(font, 40)
|
10 |
+
#console.log(fnt)
|
11 |
+
d = ImageDraw.Draw(out)
|
12 |
+
d.multiline_text((10, 64), text, fill=(0, 0, 0))
|
13 |
+
#d.multiline_text((10, 64), text, font=fnt, fill=(0, 0, 0))
|
14 |
+
out.show()
|
15 |
+
return out
|
16 |
+
|
17 |
+
demo = gr.Interface(
|
18 |
+
title="AI text decorator",
|
19 |
+
description="christina",
|
20 |
+
fn=drawImage,
|
21 |
+
inputs=[
|
22 |
+
gr.Textbox(placeholder="shift + enter for new line",label="what do you want to say?"),
|
23 |
+
"file"
|
24 |
+
#gr.Textbox(placeholder="prompt",label="how does your message look and feel?") #figure out models in series
|
25 |
+
],
|
26 |
+
outputs="image")
|
27 |
+
demo.launch()
|