Spaces:
Runtime error
Runtime error
Jojohickman21
commited on
Commit
·
5cef195
1
Parent(s):
59d2621
Main program
Browse files- app.py +14 -0
- requirements.txt +2 -0
app.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from fastai.vision.all import *
|
| 3 |
+
import skimage
|
| 4 |
+
|
| 5 |
+
learn = load_learner('export.pkl')
|
| 6 |
+
|
| 7 |
+
labels = learner.dls.vocab
|
| 8 |
+
def predict(img):
|
| 9 |
+
img = PILImage.create(img)
|
| 10 |
+
pred,pred_idx,probs = learner.predict(img)
|
| 11 |
+
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
gr.Interface(enable_queue= true,title= "Ivy League Logo/Emblem Classifier",fn=predict, inputs=gr.inputs.Image(shape=(256,256)), outputs=gr.outputs.Label(num_top_classes=3),examples=[fnames[0],fnames[1],fnames[2],fnames[3],fnames[4],fnames[5],fnames[6],fnames[7]]).launch(share=True)
|
requirements.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
fastai
|
| 2 |
+
scikit-image
|