My-AI-Projects commited on
Commit
972667b
·
verified ·
1 Parent(s): be9692d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -112,17 +112,21 @@ def colorize(img):
112
  unique_imgfilename = str(uuid.uuid4()) + '.png'
113
  cv2.imwrite(unique_imgfilename, image_out)
114
  return (img, unique_imgfilename)
115
-
 
 
116
 
117
  # Gradio demo using the Image-Slider custom component
118
- with gr.Blocks() as demo:
119
  with gr.Row():
120
  with gr.Column():
121
  bw_image = gr.Image(label='Black and White Input Image')
122
  btn = gr.Button('Convert')
 
123
  with gr.Column():
124
  col_image_slider =ImageSlider(position=0.5,
125
  label='Colored Image with Slider-view')
126
 
127
  btn.click(colorize, bw_image, col_image_slider)
 
128
  demo.launch()
 
112
  unique_imgfilename = str(uuid.uuid4()) + '.png'
113
  cv2.imwrite(unique_imgfilename, image_out)
114
  return (img, unique_imgfilename)
115
+
116
+ def clear_images():
117
+ return None, None
118
 
119
  # Gradio demo using the Image-Slider custom component
120
+ with gr.Blocks(theme="dark") as demo:
121
  with gr.Row():
122
  with gr.Column():
123
  bw_image = gr.Image(label='Black and White Input Image')
124
  btn = gr.Button('Convert')
125
+ clear = gr.Button("Clear")
126
  with gr.Column():
127
  col_image_slider =ImageSlider(position=0.5,
128
  label='Colored Image with Slider-view')
129
 
130
  btn.click(colorize, bw_image, col_image_slider)
131
+ clear.click(clear_images, outputs=[bw_image, col_image_slider])
132
  demo.launch()