ArpitaShenoy commited on
Commit
6e65593
1 Parent(s): e8e5414

added new app and requirements.txt

Browse files
Files changed (3) hide show
  1. app.py +17 -4
  2. export.pkl +3 -0
  3. requiements.txt +2 -0
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
+
2
+ __all__ = ['learn', 'categories', 'classify_images', 'image', 'label', 'intf']
3
+
4
+ import fastai
5
+ from fastai.vision.all import *
6
  import gradio as gr
7
 
8
+ learn = load_learner('export.pkl')
9
+
10
+ categories = ('barn', 'barred', 'snowy')
11
+
12
+ def classify__images(img):
13
+ preds,idx,probs = learn.predict(img)
14
+ return dict(zip(categories, map(float, probs)))
15
+
16
+ image = gr.inputs.Image(shape=(192,192))
17
+ label = gr.outputs.Label()
18
 
19
+ intf = gr.Interface(fn=classify__images, inputs=image, outputs=label)
20
+ intf.launch(inline=False)
export.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bc4600a3999b6c08b2babac66d09d672fb19c908be386b76d7e760a62fb89566
3
+ size 46967073
requiements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ fastai == 2.7.9
2
+ gradio