Beansbeansbeansbeans commited on
Commit
03fec75
·
1 Parent(s): d238832
Files changed (1) hide show
  1. app.py +45 -19
app.py CHANGED
@@ -184,35 +184,61 @@ def predict_image(inp):
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
  if __name__ == "__main__":
218
  demo.launch(show_error=True)
 
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
+ with gr.Blocks(title="Green Genius", css=css, theme=gr.themes.Monochrome()
219
+ ) as demo:
220
+
221
  with gr.Column():
222
  with gr.Column():
 
 
223
  input_image = gr.Image(label="Input Image")
224
  input_image.style(height=240)
225
  btn = gr.Button(value="Submit")
226
  btn.style(full_width=True)
227
  with gr.Column():
228
+ gr.Markdown("# We think this is?",elem_id="custom_header")
229
+ with gr.Row():
230
+ item_probs = gr.outputs.Label(label=" ",num_top_classes=1)
231
+ material_probs = gr.outputs.Label(label=" ",num_top_classes=1)
232
+ gr.Markdown("# Can it Recycle?", elem_id="custom_header")
233
+ recycling_qn = gr.outputs.Label(label=" ",)
234
+ gr.Markdown("# This Cant be Recycled when: ",elem_id="custom_header")
235
+ recycling_advice = gr.outputs.Label(label=" ",)
236
+
237
+
238
 
 
 
 
 
 
 
239
 
240
  btn.click(predict_image, inputs=[input_image],
241
  outputs=[material_probs, item_probs, recycling_qn, recycling_advice])
242
+
243
  if __name__ == "__main__":
244
  demo.launch(show_error=True)