hh871's picture
Create app.py
cd952f0
raw
history blame
558 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.inputs.Image(shape=(512, 512)),
outputs="text",
title= "Movie Poster Score Predictor",
interpretation='default',
enable_queue=True
).launch(inline=False)