Mohammed Albrayh
add app file
074c2ca
raw
history blame
584 Bytes
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()