Omnibus commited on
Commit
9f7b2a3
·
1 Parent(s): f5bc7d1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -8
app.py CHANGED
@@ -1,8 +1,8 @@
1
  import gradio as gr
2
  from overlay import txt_on_trans as tt
3
 
4
- def process(txt,font_size,font_x,font_y,font_col,font_op):
5
- return tt(txt,font_size,font_x,font_y,font_col,font_op)
6
 
7
 
8
  with gr.Blocks() as app:
@@ -11,12 +11,19 @@ with gr.Blocks() as app:
11
  with gr.Column():
12
  inp = gr.Textbox(lines = 6,min_width=100)
13
  btn = gr.Button()
14
- f_x=gr.Slider(maximum=512, step=1, value=0)
15
- f_y=gr.Slider(maximum=512, step=1, value=0)
16
- f_size=gr.Number(precision=0, value=16)
17
- f_col=gr.ColorPicker()
18
- f_op=gr.Slider(maximum=255, step=1, value=255)
 
 
 
 
 
 
 
19
 
20
  outp = gr.Pil()
21
- btn.click(process,[inp,f_size,f_x,f_y,f_col,f_op],outp)
22
  app.launch()
 
1
  import gradio as gr
2
  from overlay import txt_on_trans as tt
3
 
4
+ def process(txt,font_size,font_x,font_y,font_col,bg_col,bg_op,im_size_x,im_size_y):
5
+ return tt(txt,font_size,font_x,font_y,font_col,bg_col,bg_op,im_size_x,im_size_y)
6
 
7
 
8
  with gr.Blocks() as app:
 
11
  with gr.Column():
12
  inp = gr.Textbox(lines = 6,min_width=100)
13
  btn = gr.Button()
14
+ with gr.Row():
15
+ f_x=gr.Slider(label='Text X', maximum=512, step=1, value=0)
16
+ f_y=gr.Slider(label='Text Y', maximum=512, step=1, value=0)
17
+ with gr.Row():
18
+ f_size=gr.Number(label='Font Size',precision=0, value=32)
19
+ b_x=gr.Number(label='Image Width',precision=0, value=512)
20
+ b_y=gr.Number(label='Image Height',precision=0, value=256)
21
+
22
+ with gr.Row():
23
+ f_col=gr.ColorPicker(label='Text Color')
24
+ b_col=gr.ColorPicker(label='Background Color')
25
+ f_op=gr.Slider(label='Background Opacity', maximum=255, step=1, value=255)
26
 
27
  outp = gr.Pil()
28
+ btn.click(process,[inp,f_size,f_x,f_y,f_col,b_col,b_op,b_x,b_y],outp)
29
  app.launch()