Spaces:
Runtime error
Runtime error
| from fastai.vision.all import * | |
| import gradio as gr | |
| title = 'Sea Animals Classification' | |
| description = ''' | |
| With this Spaces, you can classify 19 different sea animals with uploading their pictures or using examples given below. | |
| Here are the list of animals into this model. 'corals', 'crabs', 'dolphin', 'eel', 'jelly fish', 'lobster', 'nudibranchs', 'octopus', 'penguin', 'puffers', 'sea rays', 'sea urchins', 'seahorse', 'seal', 'sharks', 'squid', 'starfish', 'turtle_tortoise', 'whale' | |
| <br>Source of training dataset : https://www.kaggle.com/datasets/vencerlanz09/sea-animals-image-dataste | |
| <br>You can gather information about how this model is trained : https://www.kaggle.com/code/tolgakurtulus/sea-animals-classification-with-fastai | |
| Enjoy it! 🐟 | |
| ''' | |
| article = "<p style='text-align: center'><center><img src='https://visitor-badge.glitch.me/badge?page_id=tkseaanimals' alt='visitor badge'></center></p>" | |
| learn = load_learner('model.pkl') | |
| image = gr.inputs.Image(shape=(128, 128)) | |
| label = gr.outputs.Label() | |
| examples = ['coral.jpg', 'crabs.jpg', 'sea_rays.jpg', 'turtle_tortoise.jpg'] | |
| categories = ('corals','crabs','dolphin','eel','jelly fish','lobster','nudibranchs','octopus','penguin','puffers','sea rays','sea urchins','seahorse','seal','sharks','squid','starfish','turtle_tortoise','whale') | |
| def classify_img(img): | |
| pred,idx,probs = learn.predict(img) | |
| return dict(zip(categories, map(float, probs))) | |
| interface = gr.Interface(fn=classify_img, | |
| inputs=image, | |
| title=title, | |
| article = article, | |
| description=description, | |
| outputs=label, | |
| examples=examples) | |
| interface.launch(inline=False) |