File size: 996 Bytes
7e19958
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/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()