from fastai.vision.all import * import gradio as gr import pathlib plt = platform.system() if plt == 'Linux': pathlib.WindowsPath = pathlib.PosixPath learn = load_learner('movie_score_regression_resnet18.pkl') def predict(img): img = PILImage.create(img) pred, _, _= learn.predict(img) print(pred) return str(round(pred[0], 1)) gr.Interface( fn=predict, inputs=gr.Image(shape=(182, 268)), outputs="text", title= "Movie Poster Score Predictor", interpretation='default', enable_queue=True ).launch(inline=False)