0-ma commited on
Commit
4f2203a
·
verified ·
1 Parent(s): dad1377

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -56,17 +56,17 @@ with gr.Blocks() as demo:
56
  model_dropdown = gr.Dropdown(choices=model_names, label="Select Model", value=model_names[0])
57
  image_input = gr.Image(type="pil")
58
 
59
- submit_button = gr.Button("Classify")
60
  output = gr.Label()
61
 
62
- submit_button.click(fn=predict, inputs=[image_input, model_dropdown], outputs=output)
63
-
64
  gr.Examples(
65
- examples=[[img, model_names[0]] for img in example_images],
66
- inputs=[image_input, model_dropdown],
67
  outputs=output,
68
- fn=predict,
69
  cache_examples=True,
70
  )
71
 
 
 
 
72
  demo.launch()
 
56
  model_dropdown = gr.Dropdown(choices=model_names, label="Select Model", value=model_names[0])
57
  image_input = gr.Image(type="pil")
58
 
 
59
  output = gr.Label()
60
 
 
 
61
  gr.Examples(
62
+ examples=example_images,
63
+ inputs=image_input,
64
  outputs=output,
65
+ fn=lambda img: predict(img, model_dropdown.value),
66
  cache_examples=True,
67
  )
68
 
69
+ image_input.change(fn=lambda img: predict(img, model_dropdown.value), inputs=[image_input], outputs=output)
70
+ model_dropdown.change(fn=lambda img, model: predict(img, model), inputs=[image_input, model_dropdown], outputs=output)
71
+
72
  demo.launch()