Flutra commited on
Commit
5685dab
·
1 Parent(s): e70ba90

let's deploy to hf

Browse files
Files changed (3) hide show
  1. .gitignore +60 -0
  2. app.py +20 -0
  3. requirements.txt +2 -0
.gitignore ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Python-specific ignores
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # Virtual environment
7
+ venv/
8
+ env/
9
+ *.env
10
+
11
+ # Jupyter Notebook
12
+ .ipynb_checkpoints
13
+
14
+ # Distribution / packaging
15
+ .Python
16
+ build/
17
+ develop-eggs/
18
+ dist/
19
+ downloads/
20
+ eggs/
21
+ .eggs/
22
+ lib/
23
+ lib64/
24
+ parts/
25
+ sdist/
26
+ var/
27
+ wheels/
28
+ *.egg-info/
29
+ .installed.cfg
30
+ *.egg
31
+
32
+ # PyInstaller
33
+ *.manifest
34
+ *.spec
35
+
36
+ # Logs
37
+ *.log
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .coverage
43
+ .coverage.*
44
+ .cache
45
+ nosetests.xml
46
+ coverage.xml
47
+ *.cover
48
+ .hypothesis/
49
+
50
+ # PyCharm
51
+ .idea/
52
+
53
+ # VS Code
54
+ .vscode/
55
+
56
+ # macOS
57
+ .DS_Store
58
+
59
+ # Windows
60
+ Thumbs.db
app.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from fastai.vision.all import *
3
+
4
+ def is_cat(x): return x[0].isupper()
5
+
6
+ learn = load_learner('model.pkl')
7
+
8
+ def classify_image(img):
9
+ pred, idx, probs = learn.predict(img)
10
+ return f"Prediction: {pred}. Probability: {probs[idx]:.04f}"
11
+
12
+ iface = gr.Interface(
13
+ fn=classify_image,
14
+ inputs=gr.Image(type="pil"),
15
+ outputs="text",
16
+ title="Cat Classifier",
17
+ description="Upload an image to check if it's a cat!"
18
+ )
19
+
20
+ iface.launch(inline=False)
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ fastai
2
+ gradio