simonVP commited on
Commit
d058c09
1 Parent(s): 1bd0f37

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -4
app.py CHANGED
@@ -1,7 +1,15 @@
 
1
  import gradio as gr
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
5
 
6
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- iface.launch()
 
 
 
 
 
 
 
 
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)