akshaikrishna commited on
Commit
9e1a638
1 Parent(s): 5bf8b59
Files changed (1) hide show
  1. app.py +18 -4
app.py CHANGED
@@ -1,9 +1,23 @@
1
  import gradio as gr
 
2
 
3
 
4
- def greet(name):
5
- return "Hello " + name + "MFFFF!!"
6
 
7
 
8
- demo = gr.Interface(fn=greet, inputs="text", outputs="text")
9
- demo.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
+ from fastai.vision.all import *
3
 
4
 
5
+ def is_cat(x):
6
+ return x[0].isupper()
7
 
8
 
9
+ learner = load_learner("model.pkl")
10
+
11
+ categories = ("Dog", "Cat")
12
+
13
+
14
+ def classify_image(img):
15
+ pred, idx, probs = learner.predict(img)
16
+ return dict(zip(categories, map(float, probs)))
17
+
18
+
19
+ image = gr.Image(height=192, width=192)
20
+ label = gr.Label()
21
+ # exam
22
+ intf = gr.Interface(fn=classify_image, inputs=image, outputs=label)
23
+ intf.launch()