amadinahmed
commited on
Commit
·
f8bb1ba
1
Parent(s):
adf56b7
fafafafa
Browse files
app.py
CHANGED
@@ -77,7 +77,7 @@ def predict_image(inp):
|
|
77 |
"""
|
78 |
Performs inference for a given input image and returns the prediction and CAM image.
|
79 |
"""
|
80 |
-
|
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())}
|
@@ -142,10 +142,6 @@ with gr.Blocks(title="Trash Classification", css=css) as demo:
|
|
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,7 +150,7 @@ with gr.Blocks(title="Trash Classification", css=css) as demo:
|
|
154 |
cache_examples=False,
|
155 |
)
|
156 |
|
157 |
-
btn.click(predict_image
|
158 |
outputs=[item_probs, recycling_qn, recycling_advice])
|
159 |
if __name__ == "__main__":
|
160 |
demo.launch()
|
|
|
77 |
"""
|
78 |
Performs inference for a given input image and returns the prediction and CAM image.
|
79 |
"""
|
80 |
+
|
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())}
|
|
|
142 |
recycling_advice = gr.outputs.Label()
|
143 |
gr.Markdown("### How to recycle?")
|
144 |
recycling_qn = gr.outputs.Label()
|
|
|
|
|
|
|
|
|
145 |
|
146 |
gr.Examples(
|
147 |
examples=examples,
|
|
|
150 |
cache_examples=False,
|
151 |
)
|
152 |
|
153 |
+
btn.click(predict_image, inputs=[input_image],
|
154 |
outputs=[item_probs, recycling_qn, recycling_advice])
|
155 |
if __name__ == "__main__":
|
156 |
demo.launch()
|