hh871's picture
Update app.py
35c1b6b
raw history blame
No virus
559 Bytes
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)
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'
).launch(inline=False, enable_queue=True, share=True)