File size: 584 Bytes
074c2ca
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import gradio as gr
import pickle
from fastai.vision.all import *

#Windows fix
import pathlib
temp = pathlib.PosixPath
pathlib.PosixPath = pathlib.WindowsPath


learn = load_learner('model.pkl') 

def predict(input):
    image = PILImage.create(input).resize((182, 268))
    # Use your model to make predictions on the input data
    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()