amadinahmed commited on
Commit
adf56b7
·
1 Parent(s): 784208c
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -77,7 +77,8 @@ def predict_image(inp):
77
  """
78
  Performs inference for a given input image and returns the prediction and CAM image.
79
  """
80
-
 
81
  material_label, material_label_idx, material_probs = materials_model.predict(inp)
82
  material_preds = {name: prob for name, prob in zip(material_names, material_probs.tolist())}
83
 
@@ -141,10 +142,10 @@ with gr.Blocks(title="Trash Classification", css=css) as demo:
141
  recycling_advice = gr.outputs.Label()
142
  gr.Markdown("### How to recycle?")
143
  recycling_qn = gr.outputs.Label()
144
- def submit_visible():
145
- return {results_label: gr.update(visible=True)}
146
 
147
-
 
148
 
149
  gr.Examples(
150
  examples=examples,
@@ -153,7 +154,7 @@ with gr.Blocks(title="Trash Classification", css=css) as demo:
153
  cache_examples=False,
154
  )
155
 
156
- btn.click(predict_image, submit_visible, inputs=[input_image],
157
  outputs=[item_probs, recycling_qn, recycling_advice])
158
  if __name__ == "__main__":
159
  demo.launch()
 
77
  """
78
  Performs inference for a given input image and returns the prediction and CAM image.
79
  """
80
+ submit_visible()
81
+
82
  material_label, material_label_idx, material_probs = materials_model.predict(inp)
83
  material_preds = {name: prob for name, prob in zip(material_names, material_probs.tolist())}
84
 
 
142
  recycling_advice = gr.outputs.Label()
143
  gr.Markdown("### How to recycle?")
144
  recycling_qn = gr.outputs.Label()
145
+
 
146
 
147
+ def submit_visible():
148
+ return {results_label: gr.update(visible=True)}
149
 
150
  gr.Examples(
151
  examples=examples,
 
154
  cache_examples=False,
155
  )
156
 
157
+ btn.click(predict_image(submit_visible()), inputs=[input_image],
158
  outputs=[item_probs, recycling_qn, recycling_advice])
159
  if __name__ == "__main__":
160
  demo.launch()