moshe742 commited on
Commit
8596866
·
1 Parent(s): 0ce3516

chess or not

Browse files
Files changed (4) hide show
  1. Checkers.webp +0 -0
  2. app.py +14 -4
  3. chess.jpg +0 -0
  4. dono.jpg +0 -0
Checkers.webp ADDED
app.py CHANGED
@@ -1,8 +1,18 @@
 
1
  import gradio as gr
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
5
 
6
- demo = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- demo.launch()
 
 
 
8
 
 
 
 
 
 
 
 
 
 
1
+ from fastai.vision.all import *
2
  import gradio as gr
3
 
 
 
4
 
5
+ learn = load_learner('model.pkl')
6
+
7
+
8
+ categories = ('chess', 'checkers')
9
+
10
 
11
+ def classify_image(image):
12
+ pred, idx, probs = learn.predict(image)
13
+ return dict<(zip(categories, map(float, probs)))
14
+
15
+
16
+ examples = ['chess.jpg', 'checkers.webp', "dono.jpg"]
17
+ demo = gr.Interface(fn=classify_image, inputs="image", outputs="text", examples=examples)
18
+ demo.launch()
chess.jpg ADDED
dono.jpg ADDED