Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,15 @@
|
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
def
|
4 |
-
|
5 |
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from fastai.vision.all import *
|
2 |
import gradio as gr
|
3 |
|
4 |
+
def is_player(x): return x[0]
|
5 |
+
learn = load_learner('model_basketball.pkl')
|
6 |
|
7 |
+
def classify_image(img):
|
8 |
+
pred, idx, probs = learn.predict(img)
|
9 |
+
return f'{pred} with a probability of {probs[idx]:.04f}'
|
10 |
+
|
11 |
+
image = gr.inputs.Image()
|
12 |
+
label = gr.outputs.Label()
|
13 |
+
|
14 |
+
intf = gr.Interface(fn = classify_image, inputs = image, outputs = label)
|
15 |
+
intf.launch(inline = False)
|