Spaces:
Runtime error
Runtime error
himanshu3103
commited on
Commit
Β·
e4e55a8
1
Parent(s):
b6a5e18
first commit
Browse files- Jimin.jpg +0 -0
- Jung_Kook.jpg +0 -0
- V.jpg +0 -0
- app.py +19 -0
- model.pkl +3 -0
- requirements.txt +2 -0
Jimin.jpg
ADDED
Jung_Kook.jpg
ADDED
V.jpg
ADDED
app.py
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
pred,pred_idx,probs = learn.predict(img)
|
10 |
+
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
11 |
+
|
12 |
+
title = "BTS Members Classifier"
|
13 |
+
# description = "A pet breed classifier trained on the Oxford Pets dataset with fastai. Created as a demo for Gradio and HuggingFace Spaces."
|
14 |
+
#article="<p style='text-align: center'><a href='https://tmabraham.github.io/blog/gradio_hf_spaces_tutorial' target='_blank'>Blog post</a></p>"
|
15 |
+
examples = ['Jimin.jpg','V.jpg','Jung_Kook.jpg']
|
16 |
+
interpretation='default'
|
17 |
+
enable_queue=True
|
18 |
+
|
19 |
+
gr.Interface(fn=predict,inputs=gr.inputs.Image(shape=(128, 128)),outputs=gr.outputs.Label(),title=title,examples=examples,interpretation=interpretation,enable_queue=enable_queue).launch()
|
model.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:67724520769df511520d560b21cbfb3d65534a96ebb602c26e17d216602cb3ab
|
3 |
+
size 102895105
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
fastai
|
2 |
+
scikit-image
|