AmMoPy
commited on
Commit
·
3ba28db
1
Parent(s):
1850429
No Troll
Browse files- app.py +7 -7
- requirements.txt +3 -1
app.py
CHANGED
@@ -27,15 +27,15 @@ button:hover {
|
|
27 |
"""
|
28 |
|
29 |
def classify_img(img) -> dict:
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
|
37 |
# load model
|
38 |
-
|
39 |
|
40 |
# build app
|
41 |
image = gr.Image()
|
|
|
27 |
"""
|
28 |
|
29 |
def classify_img(img) -> dict:
|
30 |
+
"""helper function to generate predictions"""
|
31 |
+
|
32 |
+
lbls = {'Cat', 'Dog'}
|
33 |
+
preds, idx, probs = model.predict(img)
|
34 |
+
|
35 |
+
return dict(zip(lbls, map(float, probs)))
|
36 |
|
37 |
# load model
|
38 |
+
model = load_learner('model_2_ep_new_data.pkl')
|
39 |
|
40 |
# build app
|
41 |
image = gr.Image()
|
requirements.txt
CHANGED
@@ -1,3 +1,5 @@
|
|
1 |
fastai==2.7.18
|
2 |
torch==2.5.1
|
3 |
-
torchvision==0.20.1
|
|
|
|
|
|
1 |
fastai==2.7.18
|
2 |
torch==2.5.1
|
3 |
+
torchvision==0.20.1
|
4 |
+
gradio==5.15.0
|
5 |
+
gradio_client==1.7.0
|