Spaces:
Sleeping
Sleeping
Sathrukan
commited on
Commit
·
4e9d1ca
1
Parent(s):
f0ffd34
let's deploy
Browse files
app.py
CHANGED
@@ -1,7 +1,18 @@
|
|
1 |
import gradio as gr
|
|
|
|
|
2 |
|
3 |
-
|
4 |
-
return "Hello " + name + "!!"
|
5 |
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
from fastai.vision.all import *
|
3 |
+
import skimage
|
4 |
|
5 |
+
learn = load_learner('model.pkl')
|
|
|
6 |
|
7 |
+
labels = learn.dls.vocab
|
8 |
+
def predict(img):
|
9 |
+
img = PILImage.create(img)
|
10 |
+
pred,pred_idx,probs = learn.predict(img)
|
11 |
+
return pred
|
12 |
+
|
13 |
+
title = "Bird Species Classifier"
|
14 |
+
description = "A bird species classifier trained on Kaggle dataset with fastai. Created as a demo for Gradio and HuggingFace Spaces(Only identifies bird species)."
|
15 |
+
examples = ['3.jpg','5.jpg','images.jpeg']
|
16 |
+
enable_queue=True
|
17 |
+
|
18 |
+
gr.Interface(fn=predict,inputs=gr.inputs.Image(shape=(224, 224)),outputs=gr.outputs.Label(num_top_classes=1),title=title,description=description,examples=examples,enable_queue=enable_queue).launch()
|