leonelhs commited on
Commit
6e907a6
·
1 Parent(s): 99c4346

working on gui

Browse files
Files changed (1) hide show
  1. app.py +7 -20
app.py CHANGED
@@ -69,27 +69,17 @@ with gr.Blocks() as app:
69
  btn_eraser = gr.Button(value="Erase scratches")
70
  btn_color = gr.Button(value="Colorize photo")
71
  btn_light = gr.Button(value="Enhance light")
72
- btn_reset = gr.Button(value="Clear", variant="primary")
 
 
73
 
74
  with gr.Column(scale=4):
75
  with gr.Row():
76
  img_input = gr.Image(label="Input", type="filepath")
77
  img_output = gr.Image(label="Result", type="filepath", interactive=False)
78
-
79
- with gr.Row():
80
- btn_swap = gr.Button(value="Swap images")
81
-
82
- with gr.Tab("Background") as tab_background:
83
- with gr.Row():
84
- with gr.Column(scale=1):
85
- btn_clear = gr.Button(value="Clear background")
86
- with gr.Accordion("New background", open=True):
87
- btn_newbgr = gr.Button(value="Change background")
88
- img_newbgr = gr.Image(label="Choose file for new background", type="filepath")
89
- with gr.Column(scale=4):
90
  with gr.Row():
91
- img_input_bgr = gr.Image(label="Input", type="filepath")
92
- img_output_bgr = gr.Image(label="Result", type="filepath", interactive=False)
93
 
94
  with gr.Tab("Settings"):
95
  with gr.Accordion("Image restoration settings", open=False):
@@ -121,13 +111,10 @@ with gr.Blocks() as app:
121
  btn_eraser.click(zero_scratches, inputs=[img_input], outputs=[img_output])
122
  btn_color.click(colorize_photo, inputs=[img_input], outputs=[img_output])
123
  btn_light.click(enhance_light, inputs=[img_input], outputs=[img_output])
124
- btn_clear.click(zero_background, inputs=[img_input_bgr], outputs=[img_output_bgr])
125
- btn_newbgr.click(zero_background, inputs=[img_input_bgr, img_newbgr], outputs=[img_output_bgr])
126
  btn_swap.click(mirror, inputs=[img_output], outputs=[img_input])
127
- btn_reset.click(lambda: None, None, img_input, queue=False)
128
- tab_background.select(mirror, inputs=[img_input], outputs=[img_input_bgr])
129
 
130
  with gr.Row():
131
  gr.HTML(footer)
132
 
133
- app.launch(debug=True, enable_queue=True)
 
69
  btn_eraser = gr.Button(value="Erase scratches")
70
  btn_color = gr.Button(value="Colorize photo")
71
  btn_light = gr.Button(value="Enhance light")
72
+ with gr.Accordion("New background", open=False):
73
+ img_newbgr = gr.Image(label="Left empty for a transparent background", type="filepath")
74
+ btn_newbgr = gr.Button(value="Change background")
75
 
76
  with gr.Column(scale=4):
77
  with gr.Row():
78
  img_input = gr.Image(label="Input", type="filepath")
79
  img_output = gr.Image(label="Result", type="filepath", interactive=False)
 
 
 
 
 
 
 
 
 
 
 
 
80
  with gr.Row():
81
+ gr.ClearButton([img_input, img_output, img_newbgr], variant="stop")
82
+ btn_swap = gr.Button(value="Swap images", variant="primary")
83
 
84
  with gr.Tab("Settings"):
85
  with gr.Accordion("Image restoration settings", open=False):
 
111
  btn_eraser.click(zero_scratches, inputs=[img_input], outputs=[img_output])
112
  btn_color.click(colorize_photo, inputs=[img_input], outputs=[img_output])
113
  btn_light.click(enhance_light, inputs=[img_input], outputs=[img_output])
114
+ btn_newbgr.click(zero_background, inputs=[img_input, img_newbgr], outputs=[img_output])
 
115
  btn_swap.click(mirror, inputs=[img_output], outputs=[img_input])
 
 
116
 
117
  with gr.Row():
118
  gr.HTML(footer)
119
 
120
+ app.launch(share=True, debug=True, enable_queue=True)