anatexis commited on
Commit
5b67610
1 Parent(s): 0f12420

first commit, lfs, with .pkl and all the rest

Browse files
Files changed (5) hide show
  1. Cole.png +0 -0
  2. Lloyd.jpg +0 -0
  3. app.py +33 -0
  4. export_main_char.pkl +3 -0
  5. requirements.txt +2 -0
Cole.png ADDED
Lloyd.jpg ADDED
app.py ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from fastai.vision.all import *
3
+ import skimage
4
+
5
+ learn = load_learner('export_main_char.pkl')
6
+
7
+ labels = ['Lloyd Garmadon',
8
+ 'Kai',
9
+ 'Cole',
10
+ 'Jay',
11
+ 'Zane',
12
+ 'Nya',
13
+ 'P.I.X.A.L.',
14
+ 'Master Wu',
15
+ 'Lord Garmadon']
16
+ labels.sort()
17
+
18
+
19
+ def predict(img):
20
+ img = PILImage.create(img)
21
+ pred, pred_idx, probs = learn.predict(img)
22
+ return {labels[i]: float(probs[i]) for i in range(len(labels))}
23
+
24
+
25
+ title = "Ninjago Main Character Classifier"
26
+ description = "Guesses the name of the Ninjago characters. Created from the fastai demo for Gradio and HuggingFace Spaces."
27
+ #article = "<p style='text-align: center'><a href='https://tmabraham.github.io/blog/gradio_hf_spaces_tutorial' target='_blank'>Blog post</a></p>"
28
+ examples = ['Lloyd.jpg', 'Cole.png']
29
+ interpretation = 'default'
30
+ enable_queue = True
31
+
32
+ gr.Interface(fn=predict, inputs=gr.inputs.Image(shape=(192, 192)), outputs=gr.outputs.Label(num_top_classes=3), title=title,
33
+ description=description, examples=examples, interpretation=interpretation, enable_queue=enable_queue).launch()
export_main_char.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6c25bb7fde4f03156c577dd9fe5f3a094ca00c97faff2a7e251b4e97533412e3
3
+ size 87482603
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ fastai
2
+ scikit-image