suddu21 commited on
Commit
c88f1c0
1 Parent(s): bb1a89a
Files changed (11) hide show
  1. app1.py +0 -0
  2. batteries.jpg +0 -0
  3. battery2.png +0 -0
  4. clothes.jpg +0 -0
  5. clothes2.jpg +0 -0
  6. plastic.jpg +0 -0
  7. plastic2.jpg +0 -0
  8. plastic3.jpg +0 -0
  9. plastic4.jpg +0 -0
  10. test.py +0 -0
  11. vgg16.py +26 -0
app1.py ADDED
File without changes
batteries.jpg ADDED
battery2.png ADDED
clothes.jpg ADDED
clothes2.jpg ADDED
plastic.jpg ADDED
plastic2.jpg ADDED
plastic3.jpg ADDED
plastic4.jpg ADDED
test.py ADDED
File without changes
vgg16.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ from tensorflow.keras.models import load_model
7
+
8
+ # load model
9
+ model = load_model('model520.h5')
10
+
11
+ #prediction classes
12
+ classnames = ['paper', 'cardboard', 'plastic', 'metal', 'food', 'battery', 'shoes', 'clothes', 'glass', 'medical']
13
+
14
+ #prediction function
15
+ def predict_image(img):
16
+ img_4d=img.reshape(-1,224, 224,3)
17
+ prediction=model.predict(img_4d)[0]
18
+ return {classnames[i]: float(prediction[i]) for i in range(len(classnames))}
19
+
20
+ #Gradio interface
21
+ image = gr.inputs.Image(shape=(224, 224))
22
+ label = gr.outputs.Label(num_top_classes=3)
23
+ article="<p style='text-align: center; font-weight:bold;'>Model based on the VGG-16 CNN</p>"
24
+
25
+ gr.Interface(fn=predict_image, inputs=image, title="Garbage Classifier VGG-16",
26
+ description="This is a Garbage Classification Model Trained using VGG-16 architecture. Deployed to Hugging Face using Gradio.", outputs=label, article=article, enable_queue=True, interpretation='default').launch(share="True")