File size: 688 Bytes
dfb4951
 
 
 
 
 
 
 
 
 
7a9f34b
 
dfb4951
 
 
 
 
 
 
 
 
 
 
 
 
 
7a9f34b
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
# -*- 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 *
from fastai.vision.widgets 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()