Spaces:
Runtime error
Runtime error
File size: 1,704 Bytes
c862bde b4f5557 5a36fee b4f5557 5a36fee b4f5557 0438ab1 c862bde aaddb0c c862bde b4f5557 0438ab1 b4f5557 c862bde 0438ab1 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
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) |