Spaces:
Runtime error
Runtime error
#!/usr/bin/env python3 | |
from fastai.vision.all import * | |
import gradio as gr | |
learn = load_learner('photos.pkl') | |
labels = learn.dls.vocab | |
def predict(img): | |
img = PILImage.create(img) | |
pred, pred_idx, probs = learn.predict(img) | |
return dict(zip(labels, map(float, probs))) | |
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 = predict, | |
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() | |