Spaces:
Runtime error
Runtime error
File size: 976 Bytes
bfac29e d5e59e9 bfac29e d5e59e9 2073fa6 d5e59e9 2073fa6 bfac29e d5e59e9 bfac29e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
from PIL import Image,ImageFont,ImageDraw
#import os
#import shutil
import gradio as gr
from gradio.mix import Series
#draw an input image based off of user's text input
def drawImage(text): #add another argument for prompt later
out = Image.new("RGB", (512, 512), (0, 0, 0))
#move font to font-directory
font = './font-directory/DimpleSans-Regular.otf'
fnt = ImageFont.truetype(font, 40)
d = ImageDraw.Draw(out)
#d.multiline_text((10, 64), text, fill=(255, 255, 255))
d.multiline_text((10, 64), text, font=fnt, fill=(0, 0, 0))
out.show()
return out
demo = gr.Interface(
title="AI text decorator",
description="christina",
fn=drawImage,
inputs=[
gr.Textbox(placeholder="shift + enter for new line",label="what do you want to say?"),
#"file"
#gr.Textbox(placeholder="prompt",label="how does your message look and feel?") #figure out models in series
],
outputs="image")
demo.launch() |