Spaces:
Sleeping
Sleeping
Commit
·
20dda03
1
Parent(s):
8371b8e
app.py
CHANGED
@@ -184,36 +184,36 @@ def predict_image(inp):
|
|
184 |
raise Exception("Invalid file format! Please only upload .jpg or .png files!")
|
185 |
|
186 |
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
|
218 |
css = """
|
219 |
#warning {background-color: #FFCCCB}
|
|
|
184 |
raise Exception("Invalid file format! Please only upload .jpg or .png files!")
|
185 |
|
186 |
|
187 |
+
with gr.Blocks(title="Trash Classification", css="#custom_header {min-height: 3rem} #custom_title {min-height: 3rem; text-align: center}") as demo:#, theme=seafoam) as demo:
|
188 |
+
gr.Markdown("# Check whether your trash is recyclable or not!", elem_id="custom_title")
|
189 |
+
gr.Markdown("Gradio Inference interface for classification of trash and recyclables. To use it, simply upload your image, or click one of the examples to load them. Images uploaded are never saved or indexed. No data or images uploaded are saved or logged.", elem_id="custom_title")
|
190 |
+
|
191 |
+
with gr.Column():
|
192 |
+
with gr.Column():
|
193 |
+
with gr.Box():
|
194 |
+
gr.Markdown("## Inputs", elem_id="custom_header")
|
195 |
+
input_image = gr.Image(label="Input Image")
|
196 |
+
input_image.style(height=240)
|
197 |
+
btn = gr.Button(value="Submit")
|
198 |
+
btn.style(full_width=True)
|
199 |
+
with gr.Column():
|
200 |
+
with gr.Box():
|
201 |
+
gr.Markdown("## Outputs", elem_id="custom_header")
|
202 |
+
recycling_qn = gr.outputs.Textbox(label="Is this recyclable?")
|
203 |
+
recycling_advice = gr.outputs.Textbox(label="It is not recyclable when:")
|
204 |
+
with gr.Row():
|
205 |
+
material_probs = gr.outputs.Label(label="Material Prediction")
|
206 |
+
item_probs = gr.outputs.Label(label="Item Prediction")
|
207 |
|
208 |
+
gr.Examples(
|
209 |
+
examples=examples,
|
210 |
+
inputs=input_image,
|
211 |
+
fn=predict_image,
|
212 |
+
cache_examples=False,
|
213 |
+
)
|
214 |
+
|
215 |
+
btn.click(predict_image, inputs=[input_image],
|
216 |
+
outputs=[material_probs, item_probs, recycling_qn, recycling_advice])
|
217 |
|
218 |
css = """
|
219 |
#warning {background-color: #FFCCCB}
|