fffiloni commited on
Commit
9250557
1 Parent(s): b59317d

add reset button

Browse files
Files changed (1) hide show
  1. app.py +13 -1
app.py CHANGED
@@ -9,6 +9,9 @@ from utils.gradio_helpers import parse_outputs, process_outputs
9
  def display_uploaded_image(image_in):
10
  return image_in
11
 
 
 
 
12
  names = ['image', 'rotate_pitch', 'rotate_yaw', 'rotate_roll', 'blink', 'eyebrow', 'wink', 'pupil_x', 'pupil_y', 'aaa', 'eee', 'woo', 'smile', 'src_ratio', 'sample_ratio', 'crop_factor', 'output_format', 'output_quality']
13
 
14
  def predict(request: gr.Request, *args, progress=gr.Progress(track_tqdm=True)):
@@ -144,7 +147,9 @@ with gr.Blocks(css=css) as demo:
144
  output_quality = gr.Number(
145
  label="Output Quality", info='''Quality of the output images, from 0 to 100. 100 is best quality, 0 is lowest quality.''', value=95
146
  )
147
- submit_btn = gr.Button("Submit")
 
 
148
  with gr.Column():
149
  result_image = gr.Image(elem_id="top")
150
  gr.HTML("""
@@ -167,6 +172,13 @@ with gr.Blocks(css=css) as demo:
167
  outputs = [result_image],
168
  queue = False
169
  )
 
 
 
 
 
 
 
170
 
171
  submit_btn.click(
172
  fn=predict,
 
9
  def display_uploaded_image(image_in):
10
  return image_in
11
 
12
+ def reset_parameters():
13
+ return gr.update(value=0), gr.update(value=0), gr.update(value=0), gr.update(value=0), gr.update(value=0), gr.update(value=0), gr.update(value=0), gr.update(value=0), gr.update(value=0), gr.update(value=0), gr.update(value=0), gr.update(value=0)
14
+
15
  names = ['image', 'rotate_pitch', 'rotate_yaw', 'rotate_roll', 'blink', 'eyebrow', 'wink', 'pupil_x', 'pupil_y', 'aaa', 'eee', 'woo', 'smile', 'src_ratio', 'sample_ratio', 'crop_factor', 'output_format', 'output_quality']
16
 
17
  def predict(request: gr.Request, *args, progress=gr.Progress(track_tqdm=True)):
 
147
  output_quality = gr.Number(
148
  label="Output Quality", info='''Quality of the output images, from 0 to 100. 100 is best quality, 0 is lowest quality.''', value=95
149
  )
150
+ with gr.Row():
151
+ reset_btn = gr.Button("Reset")
152
+ submit_btn = gr.Button("Submit")
153
  with gr.Column():
154
  result_image = gr.Image(elem_id="top")
155
  gr.HTML("""
 
172
  outputs = [result_image],
173
  queue = False
174
  )
175
+
176
+ reset_btn.click(
177
+ fn = reset_parameters,
178
+ inputs = None,
179
+ outputs = [rotate_pitch, rotate_yaw, rotate_roll, blink, eyebrow, wink, pupil_x, pupil_y, aaa, eee, woo, smile],
180
+ queue = False
181
+ )
182
 
183
  submit_btn.click(
184
  fn=predict,