File size: 431 Bytes
074c2ca
 
 
 
 
 
 
 
 
 
 
 
 
 
4963a25
074c2ca
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import gradio as gr
import pickle
from fastai.vision.all import *


learn = load_learner('model.pkl') 

def predict(input):
    image = PILImage.create(input).resize((182, 268))
    results = learn.predict(image)[0]
    results = ', '.join(results)
    return results


demo = gr.Interface(fn=predict, inputs="image",examples=['examples/Gun.jpg','examples/mario movie.jpg','examples/lalaLand.jpg'] ,outputs="text")
demo.launch()