Spaces:
Runtime error
Runtime error
Download app.py from jesherjoshua/Pokemon_Classifier: direct link, hf CLI and curl.
- Browser
- Download file 604 Bytes
-
https://huggingface.co/spaces/jesherjoshua/Pokemon_Classifier/resolve/main/app.py
- Command line
-
hf download hf://spaces/jesherjoshua/Pokemon_Classifier/app.py
-
curl -L -o app.py https://huggingface.co/spaces/jesherjoshua/Pokemon_Classifier/resolve/main/app.py
604 Bytes
| import gradio as gr | |
| import numpy as np | |
| import tensorflow as tf | |
| def classify_image(inp): | |
| new_image = np.zeros((120, 120, 4)) | |
| # Copy the original image to the first three channels of the new array | |
| new_image[:,:,0:3] = inp[:,:,:] | |
| model = tf.keras.models.load_model('poke.h5') | |
| prediction=np.argmax(model.predict(np.expand_dims(new_image,axis=0))) | |
| prediction=int(prediction) | |
| if prediction==1: | |
| return "Water" | |
| else: | |
| return "Fire" | |
| gr.Interface(fn=classify_image, | |
| inputs=gr.Image(shape=(120,120)), | |
| outputs=gr.Label(), | |
| ).launch() | |