Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -98,4 +98,24 @@ if model is not None:
|
|
| 98 |
|
| 99 |
# Use sources=['webcam'] instead of source="webcam"
|
| 100 |
image_input = gr.Image(sources=['webcam'], type="pil", label="Webcam Feed")
|
| 101 |
-
label_output
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 98 |
|
| 99 |
# Use sources=['webcam'] instead of source="webcam"
|
| 100 |
image_input = gr.Image(sources=['webcam'], type="pil", label="Webcam Feed")
|
| 101 |
+
label_output = gr.Label(num_top_classes=len(CLASS_NAMES), label="Classification Results")
|
| 102 |
+
|
| 103 |
+
interface = gr.Interface(
|
| 104 |
+
fn=classify_waste,
|
| 105 |
+
inputs=image_input,
|
| 106 |
+
outputs=label_output,
|
| 107 |
+
title="Smart Waste Sort Classifier",
|
| 108 |
+
description="Point your webcam at an item and click 'Submit' to classify it.",
|
| 109 |
+
allow_flagging="never"
|
| 110 |
+
)
|
| 111 |
+
|
| 112 |
+
print("Launching Gradio interface")
|
| 113 |
+
interface.launch()
|
| 114 |
+
else:
|
| 115 |
+
print("Model failed to load - not launching interface")
|
| 116 |
+
gr.Interface(
|
| 117 |
+
fn=lambda: "Model failed to load. Check logs for details.",
|
| 118 |
+
inputs=None,
|
| 119 |
+
outputs="text",
|
| 120 |
+
title="Error Loading Model"
|
| 121 |
+
).launch()
|