import gradio as gr | |
import pickle | |
from fastai.vision.all import * | |
learn = load_learner('model.pkl') | |
def predict(input): | |
image = PILImage.create(input).resize((182, 268)) | |
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() |