ali89 commited on
Commit
0d0bebd
1 Parent(s): 3a64568

adding model to git for huggingface deployment

Browse files
Files changed (3) hide show
  1. app.py +17 -0
  2. model/model_files/bball_model.pkl +3 -0
  3. requirements.txt +3 -0
app.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from fastai.vision.all import *
3
+
4
+ def greet(name):
5
+ return "Hello " + name + "!"
6
+
7
+ learn = load_learner('model/model_files/bball_model.pkl')
8
+ labels = learn.dls.vocab
9
+ def predict(img):
10
+ img = PILImage.create(img)
11
+ pred,pred_idx,probs = learn.predict(img)
12
+ return {labels[i]: float(probs[i]) for i in range(len(labels))}
13
+
14
+ demo = gr.Interface(fn=predict, inputs="image", outputs="text")
15
+ # demo = gr.Interface(fn=greet, inputs="text", outputs="text")
16
+
17
+ demo.launch(share=True)
model/model_files/bball_model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:898393e4850f8fb1200c0c988bd3f337d42c7046fb7e3b20afa9359a734078ec
3
+ size 46955409
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ fastai
2
+ gradio
3
+ scikit-image