text-to-post / app.py
Omnibus's picture
Update app.py
d1d63c6
import gradio as gr
from overlay import txt_on_trans as tt
def process(txt,font_size,font_x,font_y,font_col,bg_col,bg_op,im_size_x,im_size_y):
return tt(txt,font_size,font_x,font_y,font_col,bg_col,bg_op,im_size_x,im_size_y)
with gr.Blocks() as app:
with gr.Row():
with gr.Column():
inp = gr.Textbox(lines = 6,min_width=100)
btn = gr.Button()
with gr.Row():
f_x=gr.Slider(label='Text X', maximum=512, step=1, value=0)
f_y=gr.Slider(label='Text Y', maximum=512, step=1, value=0)
with gr.Row():
f_size=gr.Number(label='Font Size',precision=0, value=32)
b_x=gr.Number(label='Image Width',precision=0, value=512)
b_y=gr.Number(label='Image Height',precision=0, value=256)
with gr.Row():
f_col=gr.ColorPicker(label='Text Color')
b_col=gr.ColorPicker(label='Background Color', value = '#FFFFFF')
b_op=gr.Slider(label='Background Opacity', maximum=255, step=1, value=255)
outp = gr.Pil()
btn.click(process,[inp,f_size,f_x,f_y,f_col,b_col,b_op,b_x,b_y],outp)
app.launch()