eeshawn commited on
Commit
35b7b7a
1 Parent(s): 03320ec

update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -6
app.py CHANGED
@@ -59,8 +59,10 @@ with gr.Blocks() as demo:
59
  )
60
  with gr.Row():
61
  with gr.Column():
62
- img_input = gr.Image(source="upload", type="pil", label="Image Upload", interactive=True),
63
- conf_input = gr.Slider(minimum=0.05, maximum=1.0, value=0.5, step=0.05, label="Confidence Threshold"),
 
 
64
  with gr.Row():
65
  clear_form = gr.Button("Reset")
66
  submit = gr.Button("Predict")
@@ -75,11 +77,11 @@ with gr.Blocks() as demo:
75
  """
76
  )
77
 
78
- callback.setup([img_input, conf_input, outputs], "flagged_data")
79
 
80
- # clear_form.click(fn=clear, inputs=None, outputs=[img_input, conf_input], show_progress=False)
81
- submit.click(fn=seal_detection, inputs=[img_input, conf_input], outputs=outputs)
82
- flag.click(lambda *args: callback.flag(args), [img_input, conf_input, outputs], None, preprocess=False, show_progress=False)
83
 
84
  if __name__ == "__main__":
85
  demo.queue(api_open=False, max_size=10)
 
59
  )
60
  with gr.Row():
61
  with gr.Column():
62
+ inputs = [
63
+ gr.Image(source="upload", type="pil", label="Image Upload", interactive=True),
64
+ gr.Slider(minimum=0.05, maximum=1.0, value=0.5, step=0.05, label="Confidence Threshold"),
65
+ ]
66
  with gr.Row():
67
  clear_form = gr.Button("Reset")
68
  submit = gr.Button("Predict")
 
77
  """
78
  )
79
 
80
+ callback.setup([inputs, outputs], "flagged_data")
81
 
82
+ clear_form.click(fn=clear, inputs=None, outputs=[inputs], show_progress=False)
83
+ submit.click(fn=seal_detection, inputs=[inputs], outputs=outputs)
84
+ flag.click(lambda *args: callback.flag(args), [inputs, outputs], None, preprocess=False, show_progress=False)
85
 
86
  if __name__ == "__main__":
87
  demo.queue(api_open=False, max_size=10)