Spaces:
Runtime error
Runtime error
gradio app for checking our photo quality
Browse files- app.py +14 -3
- photos.pkl +3 -0
- requirements.txt +3 -0
app.py
CHANGED
@@ -1,7 +1,18 @@
|
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
|
4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
-
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
7 |
iface.launch()
|
|
|
1 |
+
from fastai.vision.all import *
|
2 |
import gradio as gr
|
3 |
|
4 |
+
learn = load_learner('photos.pkl')
|
5 |
+
labels = learn.dls.vocab
|
6 |
+
|
7 |
+
def predict(img):
|
8 |
+
img = PILImage.create(img)
|
9 |
+
pred, pred_idx, probs = learn.predict(img)
|
10 |
+
return dict(zip(labels, map(float, probs)))
|
11 |
+
|
12 |
+
iface = gr.Interface(
|
13 |
+
fn=predict,
|
14 |
+
inputs=gr.inputs.Image(shape=(512,512)),
|
15 |
+
outputs=gr.outputs.Label(num_top_classes=3)
|
16 |
+
)
|
17 |
|
|
|
18 |
iface.launch()
|
photos.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:eaa9ebceef712ca26cbc459b820b7eea056e7db2b2fe967e49811e8a8a9a3124
|
3 |
+
size 87728363
|
requirements.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
fastai
|
2 |
+
gradio
|
3 |
+
scikit-image
|