Spaces:
Build error
Build error
jaydemirandilla
commited on
Commit
•
b0eb703
1
Parent(s):
5f2d620
Upload 7 files
Browse files- app.py +32 -0
- fruit_model_v6.pkl +3 -0
- requirements.txt +103 -0
- test_0.jpg +0 -0
- test_1.jpg +0 -0
- test_2.jpg +0 -0
- test_4.jpeg +0 -0
app.py
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from fastai.vision.all import *
|
2 |
+
from fastai.vision.all import load_learner
|
3 |
+
import gradio as gr
|
4 |
+
|
5 |
+
fruit_labels = ('Apple', 'Apricot', 'Avocado',
|
6 |
+
'Banana', 'Blueberry',
|
7 |
+
'Carambola', 'Cherry', 'Fig',
|
8 |
+
'Grape', 'Kiwi', 'Lemon',
|
9 |
+
'Lychee', 'Mango',
|
10 |
+
'Orange', 'Papaya',
|
11 |
+
'Pear', 'Pineapple',
|
12 |
+
'Raspberry', 'Strawberry', 'Watermelon')
|
13 |
+
|
14 |
+
model=load_learner("fruit_model_v6.pkl")
|
15 |
+
|
16 |
+
def recognize_image(image):
|
17 |
+
pred, idx, probs = model.predict(image)
|
18 |
+
print(pred)
|
19 |
+
return dict(zip(fruit_labels, map(float, probs)))
|
20 |
+
|
21 |
+
|
22 |
+
image = gr.inputs.Image(shape=(192,192))
|
23 |
+
label = gr.outputs.Label(num_top_classes=5)
|
24 |
+
examples = [
|
25 |
+
'test_0.jpg',
|
26 |
+
'test_1.jpg',
|
27 |
+
'test_2.jpg',
|
28 |
+
'test_4.jpeg'
|
29 |
+
]
|
30 |
+
|
31 |
+
iface = gr.Interface(fn=recognize_image, inputs=image, outputs=label, examples=examples)
|
32 |
+
iface.launch(inline=False)
|
fruit_model_v6.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:330725920c4563ff4493d06ae4ec3963748b89868c19938d0c7b08adcbc68658
|
3 |
+
size 102991809
|
requirements.txt
ADDED
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
aiofiles==23.2.1
|
2 |
+
altair==5.3.0
|
3 |
+
annotated-types==0.6.0
|
4 |
+
anyio==4.3.0
|
5 |
+
attrs==23.2.0
|
6 |
+
blis==0.7.11
|
7 |
+
catalogue==2.0.10
|
8 |
+
certifi==2024.2.2
|
9 |
+
charset-normalizer==3.3.2
|
10 |
+
click==8.1.7
|
11 |
+
cloudpathlib==0.16.0
|
12 |
+
confection==0.1.4
|
13 |
+
contourpy==1.2.1
|
14 |
+
cycler==0.12.1
|
15 |
+
cymem==2.0.8
|
16 |
+
dnspython==2.6.1
|
17 |
+
email_validator==2.1.1
|
18 |
+
fastai==2.7.15
|
19 |
+
fastapi==0.111.0
|
20 |
+
fastapi-cli==0.0.2
|
21 |
+
fastcore==1.5.33
|
22 |
+
fastdownload==0.0.7
|
23 |
+
fastprogress==1.0.3
|
24 |
+
ffmpy==0.3.2
|
25 |
+
filelock==3.14.0
|
26 |
+
fonttools==4.51.0
|
27 |
+
fsspec==2024.3.1
|
28 |
+
gradio==3.50.0
|
29 |
+
gradio_client==0.6.1
|
30 |
+
h11==0.14.0
|
31 |
+
httpcore==1.0.5
|
32 |
+
httptools==0.6.1
|
33 |
+
httpx==0.27.0
|
34 |
+
huggingface-hub==0.23.0
|
35 |
+
idna==3.7
|
36 |
+
importlib_resources==6.4.0
|
37 |
+
Jinja2==3.1.4
|
38 |
+
joblib==1.4.2
|
39 |
+
jsonschema==4.22.0
|
40 |
+
jsonschema-specifications==2023.12.1
|
41 |
+
kiwisolver==1.4.5
|
42 |
+
langcodes==3.4.0
|
43 |
+
language_data==1.2.0
|
44 |
+
marisa-trie==1.1.0
|
45 |
+
markdown-it-py==3.0.0
|
46 |
+
MarkupSafe==2.1.5
|
47 |
+
matplotlib==3.8.4
|
48 |
+
mdurl==0.1.2
|
49 |
+
mpmath==1.3.0
|
50 |
+
murmurhash==1.0.10
|
51 |
+
networkx==3.3
|
52 |
+
numpy==1.26.4
|
53 |
+
orjson==3.10.3
|
54 |
+
packaging==24.0
|
55 |
+
pandas==2.2.2
|
56 |
+
pillow==10.3.0
|
57 |
+
preshed==3.0.9
|
58 |
+
pydantic==2.7.1
|
59 |
+
pydantic_core==2.18.2
|
60 |
+
pydub==0.25.1
|
61 |
+
Pygments==2.18.0
|
62 |
+
pyparsing==3.1.2
|
63 |
+
python-dateutil==2.9.0.post0
|
64 |
+
python-dotenv==1.0.1
|
65 |
+
python-multipart==0.0.9
|
66 |
+
pytz==2024.1
|
67 |
+
PyYAML==6.0.1
|
68 |
+
referencing==0.35.1
|
69 |
+
requests==2.31.0
|
70 |
+
rich==13.7.1
|
71 |
+
rpds-py==0.18.0
|
72 |
+
ruff==0.4.3
|
73 |
+
scikit-learn==1.4.2
|
74 |
+
scipy==1.13.0
|
75 |
+
semantic-version==2.10.0
|
76 |
+
shellingham==1.5.4
|
77 |
+
six==1.16.0
|
78 |
+
smart-open==6.4.0
|
79 |
+
sniffio==1.3.1
|
80 |
+
spacy==3.7.4
|
81 |
+
spacy-legacy==3.0.12
|
82 |
+
spacy-loggers==1.0.5
|
83 |
+
srsly==2.4.8
|
84 |
+
starlette==0.37.2
|
85 |
+
sympy==1.12
|
86 |
+
thinc==8.2.3
|
87 |
+
threadpoolctl==3.5.0
|
88 |
+
tomlkit==0.12.0
|
89 |
+
toolz==0.12.1
|
90 |
+
torch==2.3.0
|
91 |
+
torchvision==0.18.0
|
92 |
+
tqdm==4.66.4
|
93 |
+
typer==0.12.3
|
94 |
+
typing_extensions==4.11.0
|
95 |
+
tzdata==2024.1
|
96 |
+
ujson==5.9.0
|
97 |
+
urllib3==2.2.1
|
98 |
+
uvicorn==0.29.0
|
99 |
+
uvloop==0.19.0
|
100 |
+
wasabi==1.1.2
|
101 |
+
watchfiles==0.21.0
|
102 |
+
weasel==0.3.4
|
103 |
+
websockets==11.0.3
|
test_0.jpg
ADDED
test_1.jpg
ADDED
test_2.jpg
ADDED
test_4.jpeg
ADDED