Lars2000 commited on
Commit
81b6e8a
·
1 Parent(s): ae21d32
Files changed (2) hide show
  1. .gitignore +2 -1
  2. app.py +6 -3
.gitignore CHANGED
@@ -1 +1,2 @@
1
- pokemon_classifier_model.keras
 
 
1
+ pokemon_classifier_model.keras
2
+ main.ipynb
app.py CHANGED
@@ -1,9 +1,12 @@
1
  import gradio as gr
2
- from tensorflow.keras.models import load_model
3
  from PIL import Image
4
  import numpy as np
5
 
6
- model = load_model('pokemon_classifier_model.keras')
 
 
 
7
 
8
  def predict_image(img):
9
  img = img.resize((224, 224))
@@ -19,7 +22,7 @@ iface = gr.Interface(fn=predict_image,
19
  inputs=gr.inputs.Image(shape=(224, 224)),
20
  outputs=gr.outputs.Label(num_top_classes=3),
21
  title="Pokémon Classifier",
22
- examples=["images/pickachu.png", "images/squirtle.png", "images/sandshrew.png", "images/5.jpeg"],
23
  description="Upload an image of Pikachu, Sandshrew, or Squirtle and the classifier will predict which one it is.")
24
 
25
  iface.launch()
 
1
  import gradio as gr
2
+ import tensorflow as tf
3
  from PIL import Image
4
  import numpy as np
5
 
6
+ model_path = "pokemon_classifier_model.keras"
7
+
8
+ model = tf.keras.models.load_model(model_path)
9
+
10
 
11
  def predict_image(img):
12
  img = img.resize((224, 224))
 
22
  inputs=gr.inputs.Image(shape=(224, 224)),
23
  outputs=gr.outputs.Label(num_top_classes=3),
24
  title="Pokémon Classifier",
25
+ examples=["images/pickachu.png", "images/squirtle.png", "images/sandshrew.png", "images/5.jpeg"],
26
  description="Upload an image of Pikachu, Sandshrew, or Squirtle and the classifier will predict which one it is.")
27
 
28
  iface.launch()