Spaces:
Sleeping
Sleeping
refactor a bit
Browse files
app.py
CHANGED
@@ -1,16 +1,15 @@
|
|
1 |
-
from fastai.vision.all import *
|
2 |
from huggingface_hub import from_pretrained_fastai
|
3 |
import gradio as gr
|
4 |
|
5 |
|
6 |
categories = ('chess', 'checkers')
|
7 |
repo_id = "moshe742/chess-or-not"
|
8 |
-
|
9 |
|
10 |
|
11 |
def classify_image(image):
|
12 |
-
global
|
13 |
-
pred, idx, probs =
|
14 |
return dict(zip(categories, map(float, probs)))
|
15 |
|
16 |
|
|
|
|
|
1 |
from huggingface_hub import from_pretrained_fastai
|
2 |
import gradio as gr
|
3 |
|
4 |
|
5 |
categories = ('chess', 'checkers')
|
6 |
repo_id = "moshe742/chess-or-not"
|
7 |
+
learn = from_pretrained_fastai(repo_id)
|
8 |
|
9 |
|
10 |
def classify_image(image):
|
11 |
+
global learn
|
12 |
+
pred, idx, probs = learn.predict(image)
|
13 |
return dict(zip(categories, map(float, probs)))
|
14 |
|
15 |
|