|
|
|
"""app.ipynb |
|
|
|
Automatically generated by Colaboratory. |
|
|
|
Original file is located at |
|
https://colab.research.google.com/drive/1H_HXmDbBPgwXLNM5tj0G4owH5VOLqlF0 |
|
""" |
|
|
|
from fastai.vision.all import * |
|
import gradio as gr |
|
import skimage |
|
|
|
learn = load_learner('export.pkl') |
|
|
|
labels = learn.dls.vocab |
|
def predict(img): |
|
img = PILImage.create(img) |
|
pred,pred_idx,probs = learn.predict(img) |
|
return {labels[i]: float(probs[i]) for i in range(len(labels))} |
|
|
|
title = "Clasificador de fotos de pingüinos" |
|
description = "Entrenado sobre resnet18 con fastai" |
|
article="<p style='text-align: center'><a href='https://github.com/CodeRic28/penguin_classifier_fine_tune' target='_blank'>Github Repository</a></p>" |
|
|
|
examples = ['gentoo1.jpg','chin.jpeg','adelie.jpg'] |
|
gr.Interface(fn=predict, inputs=gr.inputs.Image(shape=(512, 512)), outputs=gr.outputs.Label(num_top_classes=3),examples=examples,title=title,description=description,article=article).launch() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|