2Much2Code:) commited on
Commit
efc8d6d
1 Parent(s): e276973
Files changed (11) hide show
  1. .python-version +1 -0
  2. README.md +1 -0
  3. app.py +28 -0
  4. battery.jpg +0 -0
  5. cardboard.jpeg +0 -0
  6. clothes.jpeg +0 -0
  7. glass.jpg +0 -0
  8. metal.jpg +0 -0
  9. model804.h5 +3 -0
  10. plastic.jpg +0 -0
  11. shoes.jpg +0 -0
.python-version ADDED
@@ -0,0 +1 @@
 
 
1
+ 3.7.6
README.md CHANGED
@@ -7,6 +7,7 @@ sdk: gradio
7
  sdk_version: 3.1.4
8
  app_file: app.py
9
  pinned: false
 
10
  ---
11
 
12
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
7
  sdk_version: 3.1.4
8
  app_file: app.py
9
  pinned: false
10
+ python_version: 3.7.6
11
  ---
12
 
13
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
app.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import tensorflow as tf
3
+ import numpy as np
4
+ from PIL import Image
5
+ import tensorflow.keras as keras
6
+ import keras.applications.xception as xception
7
+ from tensorflow.keras.models import load_model
8
+
9
+ # load model
10
+ model = load_model('model12.h5')
11
+
12
+ classnames = ['battery','biological','brown-glass','cardboard','clothes','green-glass','metal','paper','plastic','shoes','trash','white-glass']
13
+
14
+
15
+
16
+ def predict_image(img):
17
+ img_4d=img.reshape(-1,320, 320,3)
18
+ prediction=model.predict(img_4d)[0]
19
+ return {classnames[i]: float(prediction[i]) for i in range(12)}
20
+
21
+ image = gr.inputs.Image(shape=(320, 320))
22
+ label = gr.outputs.Label(num_top_classes=3)
23
+ enable_queue=True
24
+ examples = ['battery.jpg','cardboard.jpeg','clothes.jpeg','glass.jpg','metal.jpg','plastic.jpg','shoes.jpg']
25
+ article="<p style='text-align: center'>Made by Aditya Narendra with 🖤</p>"
26
+
27
+ gr.Interface(fn=predict_image, inputs=image, title="Garbage Classifier",
28
+ description="This is a Garbage Classification Model Trained using Xception Net.Deployed to Hugging Faces using Gradio.",outputs=label,article=article,enable_queue=enable_queue,examples=examples,interpretation='default').launch(share="True")
battery.jpg ADDED
cardboard.jpeg ADDED
clothes.jpeg ADDED
glass.jpg ADDED
metal.jpg ADDED
model804.h5 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:adba5e3a50ae004a826f1ff3df5c5841b7ec59e781cff0fe7a9ee158d8724fb2
3
+ size 83963016
plastic.jpg ADDED
shoes.jpg ADDED