Dinoking commited on
Commit
b4ccd09
1 Parent(s): efc8d6d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -7,16 +7,16 @@ 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)
@@ -25,4 +25,4 @@ examples = ['battery.jpg','cardboard.jpeg','clothes.jpeg','glass.jpg','metal.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")
 
7
  from tensorflow.keras.models import load_model
8
 
9
  # load model
10
+ model = load_model('model804.h5')
11
 
12
+ classnames = ['battery','cardboard','clothes','food','glass','medical','metal','paper','plastic','shoes']
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(10)}
20
 
21
  image = gr.inputs.Image(shape=(320, 320))
22
  label = gr.outputs.Label(num_top_classes=3)
 
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 on DS11 Mod(Seg10 V4).Deployed to Hugging Faces using Gradio.",outputs=label,article=article,enable_queue=enable_queue,examples=examples,interpretation='default').launch(share="True")