Spaces:
Runtime error
Runtime error
Download app.py from Abdurrehman999/classTask: direct link, hf CLI and curl.
- Browser
- Download file 538 Bytes
-
https://huggingface.co/spaces/Abdurrehman999/classTask/resolve/main/app.py
- Command line
-
hf download hf://spaces/Abdurrehman999/classTask/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Abdurrehman999/classTask/resolve/main/app.py
538 Bytes
| import gradio as gr | |
| import tensorflow as tf | |
| import numpy as np | |
| from PIL import Image | |
| model = tf.keras.models.load_model("cat_dog_model (1).h5") | |
| def predict(image): | |
| img = image.resize((100,100)) | |
| img = np.array(img)/255.0 | |
| img = np.expand_dims(img, axis=0) | |
| pred = model.predict(img)[0][0] | |
| if pred > 0.5: | |
| return "Dog 🐶" | |
| else: | |
| return "Cat 🐱" | |
| interface = gr.Interface( | |
| fn=predict, | |
| inputs=gr.Image(type="pil"), | |
| outputs="text", | |
| title="Cat vs Dog Classifier" | |
| ) | |
| interface.launch() |