Spaces:
Runtime error
Runtime error
| from fastai.vision.all import * | |
| import gradio as gr | |
| import os | |
| learner = load_learner('RM_classifier.pkl') | |
| def classify_image(image): | |
| predicted, idx, probabilities = learner.predict(image) | |
| return dict(zip(learner.dls.vocab, map(float, probabilities))) | |
| image = gr.inputs.Image(shape=(224,224)) | |
| label = gr.outputs.Label() | |
| examples = [os.path.join("./images", img_path) for img_path in os.listdir( './images')] | |
| interface = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples, title='Rick and Morty Character Classifier', description='Upload an image of a Rick and Morty character') | |
| interface.launch() | |