Laura Ku commited on
Commit
054bec0
·
1 Parent(s): 265b095

add other starting bits

Browse files
Files changed (3) hide show
  1. .gitattributes +1 -0
  2. app.py +17 -4
  3. grizzly.jpeg +3 -0
.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 CHANGED
@@ -1,7 +1,20 @@
1
  import gradio as gr
 
 
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
5
 
6
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- iface.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
+ from fastai.vision.all import *
3
+ import skimage
4
 
5
+ learn = load_learner('export.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 {labels[i]: float(probs[i]) for i in range(len(labels))}
12
+
13
+ title = "Bear Classifier"
14
+ description = "A bear classifier trained on random pulled internet images with fastai. Created as a demo for Gradio and HuggingFace Spaces."
15
+ article="<p style='text-align: center'><a href='https://www.lauraku.com' target='_blank'>My website</a></p>"
16
+ examples = ['grizzly.jpeg']
17
+ interpretation='default'
18
+ enable_queue=True
19
+
20
+ gr.Interface(fn=predict,inputs=gr.inputs.Image(shape=(512, 512)),outputs=gr.outputs.Label(num_top_classes=3),title=title,description=description,article=article,examples=examples,interpretation=interpretation,enable_queue=enable_queue).launch()
grizzly.jpeg ADDED

Git LFS Details

  • SHA256: 73ba66152f92e2c0d93c593eeb4bf188c0d6f8d1e02d8c65156c5ef3a06f8ddd
  • Pointer size: 132 Bytes
  • Size of remote file: 1.32 MB