File size: 590 Bytes
29193e8
e40ad0c
 
 
29193e8
 
 
 
 
 
 
 
710a81b
 
 
 
 
 
5244156
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from fastai.vision.all import *
import gradio as gr


model_inf=load_learner('export.pkl')

categories=('Art Deco','Byzantine','Gothic','Neoclassical')

def image_classifier(img):
    pred,pred_idx,probs = model_inf.predict(img)
    return dict(zip(categories,map(float,probs)))
examples_arch=['ArtDeco.jpg','Byzantine.jpg','Gothic.jpg','Neoclassical.jpg']
intrf=intrf = gr.Interface(
    fn=image_classifier, 
    inputs=gr.Image(width=192, height=192),  # Updated syntax
    outputs=gr.Label(num_top_classes=4),     # Updated syntax
    examples=examples_arch
)
intrf.launch(inline=False)