Spaces:
Runtime error
Runtime error
improve notebook, I like tabs
Browse files- app.py +11 -11
- photo-checker.ipynb +0 -0
app.py
CHANGED
@@ -7,19 +7,19 @@ learn = load_learner('photos.pkl')
|
|
7 |
labels = learn.dls.vocab
|
8 |
|
9 |
def predict(img):
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
|
14 |
iface = gr.Interface(
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
)
|
24 |
|
25 |
iface.launch()
|
|
|
7 |
labels = learn.dls.vocab
|
8 |
|
9 |
def predict(img):
|
10 |
+
img = PILImage.create(img)
|
11 |
+
pred, pred_idx, probs = learn.predict(img)
|
12 |
+
return dict(zip(labels, map(float, probs)))
|
13 |
|
14 |
iface = gr.Interface(
|
15 |
+
title = "Photo Checker",
|
16 |
+
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.""",
|
17 |
+
fn = predict,
|
18 |
+
inputs = gr.inputs.Image(shape = (512,512)),
|
19 |
+
outputs = gr.outputs.Label(num_top_classes = 3),
|
20 |
+
examples = list(map(str, get_image_files('eg'))),
|
21 |
+
interpretation='default',
|
22 |
+
enable_queue=True,
|
23 |
)
|
24 |
|
25 |
iface.launch()
|
photo-checker.ipynb
CHANGED
The diff for this file is too large to render.
See raw diff
|
|