Spaces:
Sleeping
Sleeping
ranjith
commited on
Commit
·
2a2f560
1
Parent(s):
4fb4901
updated
Browse files
app.py
CHANGED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from fastai.vision.all import *
|
3 |
+
import skimage
|
4 |
+
import re
|
5 |
+
|
6 |
+
|
7 |
+
|
8 |
+
learn = load_learner('export.pkl')
|
9 |
+
|
10 |
+
labels = learn.dls.vocab
|
11 |
+
def predict(img):
|
12 |
+
img = PILImage.create(img)
|
13 |
+
pred,pred_idx,probs = learn.predict(img)
|
14 |
+
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
15 |
+
|
16 |
+
title = "rock classifier"
|
17 |
+
gr.Interface(fn=predict, inputs=gr.Image(), outputs=gr.Label(num_top_classes=7)).launch(share=True)
|