Caraaaaa commited on
Commit
082489e
·
1 Parent(s): 555b2a6

update .gitattributes so git lfs will track .pkl files and .jpeg

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ *.jpeg filter=lfs diff=lfs merge=lfs -text
app.py ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from fastai.vision.all import *
3
+ #import skimage # for interpretation
4
+
5
+ learn = load_learner('grain_classifier.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 = "Grain Classifier"
13
+ description = "A grain classifier trained on the xxx online images 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 = ['sample/barley_seed.jpeg',
16
+ 'sample/corn_seed.jpeg',
17
+ 'sample/rye_seed.jpeg',
18
+ 'sample/wheat_seed.jpeg']
19
+ interpretation='default' # what parts of the input are responsible for the output
20
+ enable_queue=True
21
+
22
+ gr.Interface(fn=predict,
23
+ inputs=gr.inputs.Image(shape=(224, 224)),
24
+ outputs=gr.outputs.Label(num_top_classes=4),
25
+ title=title,
26
+ description=description,
27
+ #article=article,
28
+ examples=examples,
29
+ interpretation=interpretation,
30
+ enable_queue=enable_queue).launch()
grain_classifier.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bfdd9045739bd4e3d6e65e83057bbdd0b87ca4fafae13cdb88595a9ed7bb275e
3
+ size 46979395
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ fastai
2
+ scikit-image
sample/barley_seed.jpeg ADDED

Git LFS Details

  • SHA256: c946807363f34f72c990a116b9a017dc78641b379e5f37a234601784d1128ab8
  • Pointer size: 131 Bytes
  • Size of remote file: 602 kB
sample/corn_seed.jpeg ADDED

Git LFS Details

  • SHA256: 922c6573ccbbbec306f1ce553d214832ee88a36bfba9fc18d50fc68ba631fa92
  • Pointer size: 130 Bytes
  • Size of remote file: 81 kB
sample/rye_seed.jpeg ADDED

Git LFS Details

  • SHA256: bd42dc5a929fd69f06e008a3044b4869d65f2ebc700f6480c409c740a35eccd2
  • Pointer size: 131 Bytes
  • Size of remote file: 119 kB
sample/wheat_seed.jpeg ADDED

Git LFS Details

  • SHA256: cbf16c8031494cab456ca3e4f0c58704a66f1fb4ed5186654294db947d0e5150
  • Pointer size: 132 Bytes
  • Size of remote file: 1.54 MB