first
Browse files- app.py +39 -0
- model.pkl +3 -0
- requirements.txt +39 -0
app.py
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# AUTOGENERATED! DO NOT EDIT! File to edit: Untitled.ipynb.
|
| 2 |
+
|
| 3 |
+
# %% auto 0
|
| 4 |
+
__all__ = ['temp', 'model', 'learn', 'categories', 'image', 'label', 'examples', 'intf', 'is_cat', 'classify_image']
|
| 5 |
+
|
| 6 |
+
# %% Untitled.ipynb 1
|
| 7 |
+
import numpy as np
|
| 8 |
+
import pandas as pd
|
| 9 |
+
|
| 10 |
+
# %% Untitled.ipynb 2
|
| 11 |
+
from fastai.vision.all import *
|
| 12 |
+
import gradio as gr
|
| 13 |
+
|
| 14 |
+
def is_cat(x): return x[0].isupper()
|
| 15 |
+
|
| 16 |
+
# %% Untitled.ipynb 3
|
| 17 |
+
from pathlib import Path
|
| 18 |
+
import pathlib
|
| 19 |
+
temp = pathlib.PosixPath
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
# %% Untitled.ipynb 4
|
| 23 |
+
model = Path('model.pkl')
|
| 24 |
+
learn = load_learner(model, cpu=True)
|
| 25 |
+
|
| 26 |
+
# %% Untitled.ipynb 7
|
| 27 |
+
categories = ['dog', 'cat']
|
| 28 |
+
|
| 29 |
+
def classify_image(img):
|
| 30 |
+
pred,idx,probs = learn.predict(img)
|
| 31 |
+
return dict(zip(categories, map(float, probs)))
|
| 32 |
+
|
| 33 |
+
# %% Untitled.ipynb 9
|
| 34 |
+
image = gr.Image()
|
| 35 |
+
label = gr.Label()
|
| 36 |
+
examples = ['dog.jpg', 'cat.jpg']
|
| 37 |
+
|
| 38 |
+
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
|
| 39 |
+
intf.launch(inline=False, share=True)
|
model.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7b43dc41b4856785e5267a9ebbce44c3d4b4f5f826479d5a5f292851f4f45f03
|
| 3 |
+
size 47061419
|
requirements.txt
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
asgiref==3.8.1
|
| 2 |
+
blinker==1.4
|
| 3 |
+
command-not-found==0.3
|
| 4 |
+
cryptography==3.4.8
|
| 5 |
+
dbus-python==1.2.18
|
| 6 |
+
distlib==0.3.8
|
| 7 |
+
distro==1.7.0
|
| 8 |
+
distro-info==1.1+ubuntu0.1
|
| 9 |
+
Django==5.1.2
|
| 10 |
+
filelock==3.16.1
|
| 11 |
+
httplib2==0.20.2
|
| 12 |
+
importlib-metadata==4.6.4
|
| 13 |
+
jeepney==0.7.1
|
| 14 |
+
keyring==23.5.0
|
| 15 |
+
launchpadlib==1.10.16
|
| 16 |
+
lazr.restfulclient==0.14.4
|
| 17 |
+
lazr.uri==1.0.6
|
| 18 |
+
more-itertools==8.10.0
|
| 19 |
+
mysqlclient==2.2.4
|
| 20 |
+
netifaces==0.11.0
|
| 21 |
+
numpy==2.1.2
|
| 22 |
+
oauthlib==3.2.0
|
| 23 |
+
platformdirs==4.3.6
|
| 24 |
+
PyGObject==3.42.1
|
| 25 |
+
PyJWT==2.3.0
|
| 26 |
+
pyparsing==2.4.7
|
| 27 |
+
python-apt==2.4.0+ubuntu2
|
| 28 |
+
PyYAML==5.4.1
|
| 29 |
+
SecretStorage==3.3.1
|
| 30 |
+
six==1.16.0
|
| 31 |
+
sqlparse==0.5.1
|
| 32 |
+
systemd-python==234
|
| 33 |
+
typing_extensions==4.12.2
|
| 34 |
+
ubuntu-advantage-tools==8001
|
| 35 |
+
ufw==0.36.1
|
| 36 |
+
unattended-upgrades==0.1
|
| 37 |
+
virtualenv==20.26.6
|
| 38 |
+
wadllib==1.3.6
|
| 39 |
+
zipp==1.0.0
|