Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,26 +1,16 @@
|
|
| 1 |
import os
|
| 2 |
-
os.environ["TF_USE_LEGACY_KERAS"] = "0"
|
| 3 |
os.environ["TF_ENABLE_ONEDNN_OPTS"] = "0"
|
| 4 |
|
| 5 |
import gradio as gr
|
| 6 |
import numpy as np
|
| 7 |
import tensorflow as tf
|
| 8 |
from PIL import Image
|
| 9 |
-
from huggingface_hub import hf_hub_download
|
| 10 |
|
| 11 |
# Load model
|
| 12 |
-
model_path = "waste_classifier_v2.keras"
|
| 13 |
model = tf.keras.models.load_model(model_path, compile=False)
|
| 14 |
|
| 15 |
-
|
| 16 |
-
## Also verify in `requirements.txt`:
|
| 17 |
-
```
|
| 18 |
-
tensorflow>=2.16.0
|
| 19 |
-
keras>=3.0.0
|
| 20 |
-
gradio
|
| 21 |
-
pillow
|
| 22 |
-
numpy
|
| 23 |
-
huggingface_hub
|
| 24 |
labels = [
|
| 25 |
"Cardboard",
|
| 26 |
"Glass",
|
|
@@ -41,8 +31,8 @@ demo = gr.Interface(
|
|
| 41 |
fn=classify_waste,
|
| 42 |
inputs=gr.Image(type="pil"),
|
| 43 |
outputs=gr.Label(num_top_classes=3),
|
| 44 |
-
title="Waste Classifier",
|
| 45 |
-
description="Upload a waste image to classify it."
|
| 46 |
)
|
| 47 |
|
| 48 |
demo.launch()
|
|
|
|
| 1 |
import os
|
| 2 |
+
os.environ["TF_USE_LEGACY_KERAS"] = "0"
|
| 3 |
os.environ["TF_ENABLE_ONEDNN_OPTS"] = "0"
|
| 4 |
|
| 5 |
import gradio as gr
|
| 6 |
import numpy as np
|
| 7 |
import tensorflow as tf
|
| 8 |
from PIL import Image
|
|
|
|
| 9 |
|
| 10 |
# Load model
|
| 11 |
+
model_path = "waste_classifier_v2.keras"
|
| 12 |
model = tf.keras.models.load_model(model_path, compile=False)
|
| 13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
labels = [
|
| 15 |
"Cardboard",
|
| 16 |
"Glass",
|
|
|
|
| 31 |
fn=classify_waste,
|
| 32 |
inputs=gr.Image(type="pil"),
|
| 33 |
outputs=gr.Label(num_top_classes=3),
|
| 34 |
+
title="♻️ Waste Classifier",
|
| 35 |
+
description="Upload a waste image to classify it into: Cardboard, Glass, Metal, Paper, Plastic, or Trash."
|
| 36 |
)
|
| 37 |
|
| 38 |
demo.launch()
|