File size: 567 Bytes
cd952f0
 
 
 
 
 
 
 
 
 
 
 
 
8be5261
cd952f0
 
 
 
5e25819
cd952f0
 
dc94328
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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)