File size: 303 Bytes
acd4da4
 
 
 
 
 
 
0acae92
acd4da4
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
from fastai.vision.all import *
import gradio as gr

learner = load_learner('model.pkl')

def predict_genre(img):
    pred, idx, probs = learner.predict(img)
    return dict(zip(learner.dls.vocab, map(float, probs)))


demo = gr.Interface(fn=predict_genre, inputs="image", outputs="label")
demo.launch()