Spaces:
Runtime error
Runtime error
# AUTOGENERATED! DO NOT EDIT! File to edit: photo-checker.ipynb. | |
# %% auto 0 | |
__all__ = ['learn', 'labels', 'iface', 'classify_image'] | |
# %% photo-checker.ipynb 5 | |
from fastai.vision.all import * | |
# %% photo-checker.ipynb 36 | |
learn = load_learner('photos.pkl') | |
# %% photo-checker.ipynb 58 | |
labels = learn.dls.vocab | |
# %% photo-checker.ipynb 60 | |
def classify_image(img): | |
img = PILImage.create(img) | |
pred,idx,probs = learn.predict(img) | |
return dict(zip(labels, map(float, probs))) | |
# %% photo-checker.ipynb 61 | |
import gradio as gr | |
iface = gr.Interface( | |
title = "Photo Checker", | |
description = """This project checks which of our family photos are "good" or "bad". We have nearly 80,000 photos, so it's not practical to sort them out by hand. I want to exclude screenshots, photos of computer screens, photos of papers, images with lots of text, and very blurry images. I used this to separate the good photos to use for a random slide show on our TV. The trained model achieves around 99% accuracy on the validation set.""", | |
fn = classify_image, | |
inputs = gr.inputs.Image(shape = (512,512)), | |
outputs = gr.outputs.Label(num_top_classes = 3), | |
examples = list(map(str, get_image_files('eg'))), | |
interpretation='default', | |
enable_queue=True, | |
) | |
iface.launch() | |