Spaces:
Build error
Build error
Added files
Browse files- DS11Sudhanva.h5 +3 -0
- app.py +20 -0
- requirements.txt +4 -0
DS11Sudhanva.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:09b7f5de5f07156815ddcd45e8ec0ea17ff998eaf6d4a35cb181c29fde6b6f67
|
| 3 |
+
size 153628864
|
app.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from tensorflow.keras.models import load_model
|
| 2 |
+
import gradio as gr
|
| 3 |
+
import PIL.Image as Image
|
| 4 |
+
import numpy as np
|
| 5 |
+
|
| 6 |
+
model = load_model('DS11Sudhanva.h5')
|
| 7 |
+
|
| 8 |
+
classnames = ['cardboard', 'metal','paper','plastic','trash','green-glass','white-glass','brown-glass','clothes','biological','battery','shoes']
|
| 9 |
+
|
| 10 |
+
def predict(img):
|
| 11 |
+
img=img.reshape(-1,298, 384,3)
|
| 12 |
+
prediction = model.predict(img[0])
|
| 13 |
+
return {classnames[i]: float(prediction[i]) for i in range(12)}
|
| 14 |
+
|
| 15 |
+
image = gr.inputs.Image(shape=(298, 384))
|
| 16 |
+
label = gr.outputs.Label(num_top_classes=3)
|
| 17 |
+
|
| 18 |
+
gr.Interface(fn=predict, inputs=image, title="Garbage Classifier",
|
| 19 |
+
description="This is a Garbage Classification Model Trained using Dataset 11 by Sud.Deployed to Hugging Faces using Gradio.",outputs=label,interpretation='default').launch()
|
| 20 |
+
|
requirements.txt
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
numpy
|
| 2 |
+
tensorflow
|
| 3 |
+
Pillow
|
| 4 |
+
matplotlib
|