Last commit not found
# -*- coding: utf-8 -*- | |
"""car_year_finder_p2.ipynb | |
Automatically generated by Colaboratory. | |
Original file is located at | |
https://colab.research.google.com/drive/1O0_3A82axlMsWaCiXpSv2cM0frscKrsB | |
""" | |
from fastai.vision.all import * | |
import gradio as gr | |
categories = ('before 1960','from 1970 to 1980','from 1990 to 2000', 'from 2020') | |
learn = load_learner('car_year_finder1.pkl') | |
def classify_image(img): | |
pred, idx, probs = learn.predict(img) | |
return dict(zip(categories,map(float,probs))) | |
image = gr.inputs.Image(shape=(192,192)) | |
label = gr.outputs.Label() | |
intf=gr.Interface(fn=classify_image, inputs=image, outputs=label) | |
intf.launch() | |