Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,35 +4,9 @@ from overlay import txt_on_trans as tt
|
|
| 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 |
-
def pub():
|
| 8 |
-
out = gr.HTML.update("""
|
| 9 |
-
<body>
|
| 10 |
-
<div id="summernote"></div>
|
| 11 |
-
</body>""")
|
| 12 |
-
return out
|
| 13 |
-
js1="""
|
| 14 |
-
$('#summernote').summernote({
|
| 15 |
-
placeholder: 'Hello stand alone ui',
|
| 16 |
-
tabsize: 2,
|
| 17 |
-
height: 100,
|
| 18 |
-
toolbar: [
|
| 19 |
-
['style', ['style']],
|
| 20 |
-
['font', ['bold', 'underline', 'clear']],
|
| 21 |
-
['color', ['color']],
|
| 22 |
-
['para', ['ul', 'ol', 'paragraph']],
|
| 23 |
-
['table', ['table']],
|
| 24 |
-
['insert', ['link', 'picture', 'video']],
|
| 25 |
-
['view', ['fullscreen', 'codeview', 'help']]
|
| 26 |
-
]
|
| 27 |
-
});
|
| 28 |
-
"""
|
| 29 |
|
| 30 |
with gr.Blocks() as app:
|
| 31 |
-
|
| 32 |
-
<body>
|
| 33 |
-
<div id="summernote"></div>
|
| 34 |
-
</body>
|
| 35 |
-
''')
|
| 36 |
with gr.Row():
|
| 37 |
with gr.Column():
|
| 38 |
inp = gr.Textbox(lines = 6,min_width=100)
|
|
@@ -47,10 +21,9 @@ with gr.Blocks() as app:
|
|
| 47 |
|
| 48 |
with gr.Row():
|
| 49 |
f_col=gr.ColorPicker(label='Text Color')
|
| 50 |
-
b_col=gr.ColorPicker(label='Background Color')
|
| 51 |
b_op=gr.Slider(label='Background Opacity', maximum=255, step=1, value=255)
|
| 52 |
|
| 53 |
outp = gr.Pil()
|
| 54 |
-
btn.click(fn=pub,inputs=None,outputs=this,_js=js1)
|
| 55 |
btn.click(process,[inp,f_size,f_x,f_y,f_col,b_col,b_op,b_x,b_y],outp)
|
| 56 |
app.launch()
|
|
|
|
| 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:
|
| 9 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
with gr.Row():
|
| 11 |
with gr.Column():
|
| 12 |
inp = gr.Textbox(lines = 6,min_width=100)
|
|
|
|
| 21 |
|
| 22 |
with gr.Row():
|
| 23 |
f_col=gr.ColorPicker(label='Text Color')
|
| 24 |
+
b_col=gr.ColorPicker(label='Background Color', value = '#FFFFFF')
|
| 25 |
b_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()
|