Spaces:
Sleeping
Sleeping
chess or not
Browse files
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 |
-
|
7 |
-
|
|
|
|
|
|
|
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
![]() |