amitpress commited on
Commit
e8fc84d
·
1 Parent(s): b1c1f41
Files changed (4) hide show
  1. .vscode/settings.json +11 -0
  2. app.py +20 -0
  3. model.pkl +3 -0
  4. requirements.txt +3 -0
.vscode/settings.json ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "files.exclude": {
3
+ "**/.git": true,
4
+ "**/.svn": true,
5
+ "**/.hg": true,
6
+ "**/CVS": true,
7
+ "**/.DS_Store": true,
8
+ "**/Thumbs.db": true
9
+ },
10
+ "hide-files.files": []
11
+ }
app.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from fastai.vision.all import *
3
+ from pathlib import Path
4
+ import pathlib
5
+ hugging_face = True
6
+ if not hugging_face:
7
+ temp = pathlib.PosixPath
8
+ pathlib.PosixPath = pathlib.WindowsPath
9
+ learn = load_learner(Path("./model.pkl"))
10
+ def predict_image(image):
11
+ pred, pred_idx, probs = learn.predict(image)
12
+ return pred, probs[pred_idx].item()
13
+
14
+ app = gr.Interface(fn=predict_image,
15
+ inputs=gr.Image(type="pil"),
16
+ outputs=[gr.Label(), gr.Number()],
17
+ live=True
18
+ )
19
+
20
+ app.launch()
model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cdd79ecbbd26f5b031bb69f375f84893909dce14d138bf63b740714f4e447a5e
3
+ size 102921062
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ gradio
2
+ fastai
3
+ timm