Beansbeansbeansbeans commited on
Commit
fc1e6fb
1 Parent(s): a447be8
Files changed (1) hide show
  1. app.py +49 -49
app.py CHANGED
@@ -184,67 +184,67 @@ 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
-
218
- # css = """
219
- # #warning {background-color: #FFCCCB}
220
- # #custom_header {min-height: 3rem} #custom_title {min-height: 3rem; text-align: center}
221
- # .feedback textarea {font-size: 24px !important}
222
- # """
223
-
224
- # with gr.Blocks(title="Green Genius", css=css, theme=gr.themes.Monochrome()
225
- # ) as demo:
226
-
227
  # with gr.Column():
228
  # with gr.Column():
 
 
229
  # input_image = gr.Image(label="Input Image")
230
  # input_image.style(height=240)
231
  # btn = gr.Button(value="Submit")
232
  # btn.style(full_width=True)
233
  # with gr.Column():
234
- # gr.Markdown("# We think this is?",elem_id="custom_header")
235
- # with gr.Row():
236
- # item_probs = gr.outputs.Label(label=" ",num_top_classes=1)
237
- # material_probs = gr.outputs.Label(label=" ",num_top_classes=1)
238
- # gr.Markdown("# Can it Recycle?", elem_id="custom_header")
239
- # recycling_qn = gr.outputs.Label(label=" ",)
240
- # gr.Markdown("# This Cant be Recycled when: ",elem_id="custom_header")
241
- # recycling_advice = gr.outputs.Label(label=" ",)
242
-
243
-
244
 
 
 
 
 
 
 
245
 
246
  # btn.click(predict_image, inputs=[input_image],
247
  # outputs=[material_probs, item_probs, recycling_qn, recycling_advice])
248
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
249
  if __name__ == "__main__":
250
  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
+ css = """
219
+ #warning {background-color: #FFCCCB}
220
+ #custom_header {min-height: 3rem} #custom_title {min-height: 3rem; text-align: center}
221
+ .feedback textarea {font-size: 24px !important}
222
+ """
223
+
224
+ with gr.Blocks(title="Green Genius", css=css, theme=gr.themes.Monochrome()
225
+ ) as demo:
226
+
227
+ with gr.Column():
228
+ with gr.Column():
229
+ input_image = gr.Image(label="Input Image")
230
+ input_image.style(height=240)
231
+ btn = gr.Button(value="Submit")
232
+ btn.style(full_width=True)
233
+ with gr.Column():
234
+ gr.Markdown("# We think this is?",elem_id="custom_header")
235
+ with gr.Row():
236
+ item_probs = gr.outputs.Label(label=" ",num_top_classes=1)
237
+ material_probs = gr.outputs.Label(label=" ",num_top_classes=1)
238
+ gr.Markdown("# Can it Recycle?", elem_id="custom_header")
239
+ recycling_qn = gr.outputs.Label(label=" ",)
240
+ gr.Markdown("# This Cant be Recycled when: ",elem_id="custom_header")
241
+ recycling_advice = gr.outputs.Label(label=" ",)
242
+
243
+
244
+
245
+
246
+ btn.click(predict_image, inputs=[input_image],
247
+ outputs=[material_probs, item_probs, recycling_qn, recycling_advice])
248
+
249
  if __name__ == "__main__":
250
  demo.launch(show_error=True)