Brian Burns commited on
Commit
ca9b0e0
1 Parent(s): d732c07

Add application file, pytorch saved models, requirements file

Browse files
.DS_Store ADDED
Binary file (6.15 kB). View file
 
app.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import datasets
2
+ from transformers import AutoFeatureExtractor, AutoModelForImageClassification
3
+ import gradio as gr
4
+
5
+
6
+ dataset = datasets.load_dataset("beans")
7
+
8
+ extractor = AutoFeatureExtractor.from_pretrained("saved_model_files")
9
+ model = AutoModelForImageClassification.from_pretrained("saved_model_files")
10
+
11
+ labels = dataset['train'].features['labels'].names
12
+
13
+ def classify(im):
14
+ features = feature_extractor(im, return_tensors='pt')
15
+ logits = model(features["pixel_values"])[-1]
16
+ probability = torch.nn.functional.softmax(logits, dim=-1)
17
+ probs = probability[0].detach().numpy()
18
+ confidences = {label: float(probs[i]) for i, label in enumerate(labels)}
19
+ return confidences
20
+
21
+
22
+ interface = gr.Interface(fn = classify, inputs = "image", outputs = "label",
23
+ title = "Plant health classifier",
24
+ description = "Classifies plant health"
25
+ )
26
+
27
+ interface.launch()
requirements.txt ADDED
@@ -0,0 +1,436 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ absl-py==1.2.0
2
+ aeppl==0.0.33
3
+ aesara==2.7.9
4
+ aiohttp==3.8.3
5
+ aiosignal==1.2.0
6
+ alabaster==0.7.12
7
+ albumentations==1.2.1
8
+ altair==4.2.0
9
+ anyio==3.6.1
10
+ appdirs==1.4.4
11
+ arviz==0.12.1
12
+ astor==0.8.1
13
+ astropy==4.3.1
14
+ astunparse==1.6.3
15
+ async-timeout==4.0.2
16
+ asynctest==0.13.0
17
+ atari-py==0.2.9
18
+ atomicwrites==1.4.1
19
+ attrs==22.1.0
20
+ audioread==3.0.0
21
+ autograd==1.5
22
+ Babel==2.10.3
23
+ backcall==0.2.0
24
+ bcrypt==4.0.0
25
+ beautifulsoup4==4.6.3
26
+ bleach==5.0.1
27
+ blis==0.7.8
28
+ bokeh==2.3.3
29
+ branca==0.5.0
30
+ bs4==0.0.1
31
+ CacheControl==0.12.11
32
+ cached-property==1.5.2
33
+ cachetools==4.2.4
34
+ catalogue==2.0.8
35
+ certifi==2022.9.24
36
+ cffi==1.15.1
37
+ cftime==1.6.2
38
+ chardet==3.0.4
39
+ charset-normalizer==2.1.1
40
+ click==7.1.2
41
+ clikit==0.6.2
42
+ cloudpickle==1.5.0
43
+ cmake==3.22.6
44
+ cmdstanpy==1.0.7
45
+ colorcet==3.0.1
46
+ colorlover==0.3.0
47
+ community==1.0.0b1
48
+ confection==0.0.2
49
+ cons==0.4.5
50
+ contextlib2==0.5.5
51
+ convertdate==2.4.0
52
+ crashtest==0.3.1
53
+ crcmod==1.7
54
+ cryptography==38.0.1
55
+ cufflinks==0.17.3
56
+ cupy-cuda11x==11.0.0
57
+ cvxopt==1.3.0
58
+ cvxpy==1.2.1
59
+ cycler==0.11.0
60
+ cymem==2.0.6
61
+ Cython==0.29.32
62
+ daft==0.0.4
63
+ dask==2022.2.0
64
+ datascience==0.17.5
65
+ datasets==2.5.2
66
+ debugpy==1.0.0
67
+ decorator==4.4.2
68
+ defusedxml==0.7.1
69
+ descartes==1.1.0
70
+ dill==0.3.5.1
71
+ distributed==2022.2.0
72
+ dlib==19.24.0
73
+ dm-tree==0.1.7
74
+ docutils==0.17.1
75
+ dopamine-rl==1.0.5
76
+ earthengine-api==0.1.326
77
+ easydict==1.10
78
+ ecos==2.0.10
79
+ editdistance==0.5.3
80
+ en-core-web-sm @ https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.4.0/en_core_web_sm-3.4.0-py3-none-any.whl
81
+ entrypoints==0.4
82
+ ephem==4.1.3
83
+ et-xmlfile==1.1.0
84
+ etils==0.8.0
85
+ etuples==0.3.8
86
+ evaluate==0.2.2
87
+ fa2==0.3.5
88
+ fastai==2.7.9
89
+ fastapi==0.85.0
90
+ fastcore==1.5.27
91
+ fastdownload==0.0.7
92
+ fastdtw==0.3.4
93
+ fastjsonschema==2.16.2
94
+ fastprogress==1.0.3
95
+ fastrlock==0.8
96
+ feather-format==0.4.1
97
+ ffmpy==0.3.0
98
+ filelock==3.8.0
99
+ firebase-admin==4.4.0
100
+ fix-yahoo-finance==0.0.22
101
+ Flask==1.1.4
102
+ flatbuffers==22.9.24
103
+ folium==0.12.1.post1
104
+ frozenlist==1.3.1
105
+ fsspec==2022.8.2
106
+ future==0.16.0
107
+ gast==0.5.3
108
+ GDAL==2.2.2
109
+ gdown==4.4.0
110
+ gensim==3.6.0
111
+ geographiclib==1.52
112
+ geopy==1.17.0
113
+ gin-config==0.5.0
114
+ glob2==0.7
115
+ google==2.0.3
116
+ google-api-core==1.31.6
117
+ google-api-python-client==1.12.11
118
+ google-auth==1.35.0
119
+ google-auth-httplib2==0.0.4
120
+ google-auth-oauthlib==0.4.6
121
+ google-cloud-bigquery==1.21.0
122
+ google-cloud-bigquery-storage==1.1.2
123
+ google-cloud-core==1.0.3
124
+ google-cloud-datastore==1.8.0
125
+ google-cloud-firestore==1.7.0
126
+ google-cloud-language==1.2.0
127
+ google-cloud-storage==1.18.1
128
+ google-cloud-translate==1.5.0
129
+ google-colab @ file:///colabtools/dist/google-colab-1.0.0.tar.gz
130
+ google-pasta==0.2.0
131
+ google-resumable-media==0.4.1
132
+ googleapis-common-protos==1.56.4
133
+ googledrivedownloader==0.4
134
+ gradio==3.4.1
135
+ graphviz==0.10.1
136
+ greenlet==1.1.3
137
+ grpcio==1.49.1
138
+ gspread==3.4.2
139
+ gspread-dataframe==3.0.8
140
+ gym==0.25.2
141
+ gym-notices==0.0.8
142
+ h11==0.12.0
143
+ h5py==3.1.0
144
+ HeapDict==1.0.1
145
+ hijri-converter==2.2.4
146
+ holidays==0.16
147
+ holoviews==1.14.9
148
+ html5lib==1.0.1
149
+ httpcore==0.15.0
150
+ httpimport==0.5.18
151
+ httplib2==0.17.4
152
+ httplib2shim==0.0.3
153
+ httpstan==4.6.1
154
+ httpx==0.23.0
155
+ huggingface-hub==0.10.0
156
+ humanize==0.5.1
157
+ hyperopt==0.1.2
158
+ idna==2.10
159
+ imageio==2.9.0
160
+ imagesize==1.4.1
161
+ imbalanced-learn==0.8.1
162
+ imblearn==0.0
163
+ imgaug==0.4.0
164
+ importlib-metadata==5.0.0
165
+ importlib-resources==5.9.0
166
+ imutils==0.5.4
167
+ inflect==2.1.0
168
+ intel-openmp==2022.2.0
169
+ intervaltree==2.1.0
170
+ ipykernel==5.3.4
171
+ ipython==7.9.0
172
+ ipython-genutils==0.2.0
173
+ ipython-sql==0.3.9
174
+ ipywidgets==7.7.1
175
+ itsdangerous==1.1.0
176
+ jax==0.3.21
177
+ jaxlib @ https://storage.googleapis.com/jax-releases/cuda11/jaxlib-0.3.20+cuda11.cudnn805-cp37-cp37m-manylinux2014_x86_64.whl
178
+ jieba==0.42.1
179
+ Jinja2==2.11.3
180
+ joblib==1.2.0
181
+ jpeg4py==0.1.4
182
+ jsonschema==4.3.3
183
+ jupyter-client==6.1.12
184
+ jupyter-console==6.1.0
185
+ jupyter-core==4.11.1
186
+ jupyterlab-widgets==3.0.3
187
+ kaggle==1.5.12
188
+ kapre==0.3.7
189
+ keras==2.8.0
190
+ Keras-Preprocessing==1.1.2
191
+ keras-vis==0.4.1
192
+ kiwisolver==1.4.4
193
+ korean-lunar-calendar==0.3.1
194
+ langcodes==3.3.0
195
+ libclang==14.0.6
196
+ librosa==0.8.1
197
+ lightgbm==2.2.3
198
+ linkify-it-py==1.0.3
199
+ llvmlite==0.39.1
200
+ lmdb==0.99
201
+ locket==1.0.0
202
+ logical-unification==0.4.5
203
+ LunarCalendar==0.0.9
204
+ lxml==4.9.1
205
+ Markdown==3.4.1
206
+ markdown-it-py==2.1.0
207
+ MarkupSafe==2.0.1
208
+ marshmallow==3.18.0
209
+ matplotlib==3.2.2
210
+ matplotlib-venn==0.11.7
211
+ mdit-py-plugins==0.3.1
212
+ mdurl==0.1.2
213
+ miniKanren==1.0.3
214
+ missingno==0.5.1
215
+ mistune==0.8.4
216
+ mizani==0.7.3
217
+ mkl==2019.0
218
+ mlxtend==0.14.0
219
+ more-itertools==8.14.0
220
+ moviepy==0.2.3.5
221
+ mpmath==1.2.1
222
+ msgpack==1.0.4
223
+ multidict==6.0.2
224
+ multipledispatch==0.6.0
225
+ multiprocess==0.70.13
226
+ multitasking==0.0.11
227
+ murmurhash==1.0.8
228
+ music21==5.5.0
229
+ natsort==5.5.0
230
+ nbconvert==5.6.1
231
+ nbformat==5.6.1
232
+ netCDF4==1.6.1
233
+ networkx==2.6.3
234
+ nibabel==3.0.2
235
+ nltk==3.7
236
+ notebook==5.3.1
237
+ numba==0.56.2
238
+ numexpr==2.8.3
239
+ numpy==1.21.6
240
+ oauth2client==4.1.3
241
+ oauthlib==3.2.1
242
+ okgrade==0.4.3
243
+ opencv-contrib-python==4.6.0.66
244
+ opencv-python==4.6.0.66
245
+ opencv-python-headless==4.6.0.66
246
+ openpyxl==3.0.10
247
+ opt-einsum==3.3.0
248
+ orjson==3.8.0
249
+ osqp==0.6.2.post0
250
+ packaging==21.3
251
+ palettable==3.3.0
252
+ pandas==1.3.5
253
+ pandas-datareader==0.9.0
254
+ pandas-gbq==0.13.3
255
+ pandas-profiling==1.4.1
256
+ pandocfilters==1.5.0
257
+ panel==0.12.1
258
+ param==1.12.2
259
+ paramiko==2.11.0
260
+ parso==0.8.3
261
+ partd==1.3.0
262
+ pastel==0.2.1
263
+ pathlib==1.0.1
264
+ pathy==0.6.2
265
+ patsy==0.5.2
266
+ pep517==0.13.0
267
+ pexpect==4.8.0
268
+ pickleshare==0.7.5
269
+ Pillow==7.1.2
270
+ pip-tools==6.2.0
271
+ plotly==5.5.0
272
+ plotnine==0.8.0
273
+ pluggy==0.7.1
274
+ pooch==1.6.0
275
+ portpicker==1.3.9
276
+ prefetch-generator==1.0.1
277
+ preshed==3.0.7
278
+ prettytable==3.4.1
279
+ progressbar2==3.38.0
280
+ promise==2.3
281
+ prompt-toolkit==2.0.10
282
+ prophet==1.1.1
283
+ protobuf==3.17.3
284
+ psutil==5.4.8
285
+ psycopg2==2.9.3
286
+ ptyprocess==0.7.0
287
+ py==1.11.0
288
+ pyarrow==6.0.1
289
+ pyasn1==0.4.8
290
+ pyasn1-modules==0.2.8
291
+ pycocotools==2.0.5
292
+ pycparser==2.21
293
+ pycryptodome==3.15.0
294
+ pyct==0.4.8
295
+ pydantic==1.9.2
296
+ pydata-google-auth==1.4.0
297
+ pydot==1.3.0
298
+ pydot-ng==2.0.0
299
+ pydotplus==2.0.2
300
+ PyDrive==1.3.1
301
+ pydub==0.25.1
302
+ pyemd==0.5.1
303
+ pyerfa==2.0.0.1
304
+ Pygments==2.6.1
305
+ pygobject==3.26.1
306
+ pylev==1.4.0
307
+ pymc==4.1.4
308
+ PyMeeus==0.5.11
309
+ pymongo==4.2.0
310
+ pymystem3==0.2.0
311
+ PyNaCl==1.5.0
312
+ PyOpenGL==3.1.6
313
+ pyparsing==3.0.9
314
+ pyrsistent==0.18.1
315
+ pysimdjson==3.2.0
316
+ pysndfile==1.3.8
317
+ PySocks==1.7.1
318
+ pystan==3.3.0
319
+ pytest==3.6.4
320
+ python-apt==0.0.0
321
+ python-chess==0.23.11
322
+ python-dateutil==2.8.2
323
+ python-louvain==0.16
324
+ python-multipart==0.0.5
325
+ python-slugify==6.1.2
326
+ python-utils==3.3.3
327
+ pytz==2022.4
328
+ pyviz-comms==2.2.1
329
+ PyWavelets==1.3.0
330
+ PyYAML==6.0
331
+ pyzmq==23.2.1
332
+ qdldl==0.1.5.post2
333
+ qudida==0.0.4
334
+ regex==2022.6.2
335
+ requests==2.23.0
336
+ requests-oauthlib==1.3.1
337
+ resampy==0.4.2
338
+ responses==0.18.0
339
+ rfc3986==1.5.0
340
+ rpy2==3.4.5
341
+ rsa==4.9
342
+ scikit-image==0.18.3
343
+ scikit-learn==1.0.2
344
+ scipy==1.7.3
345
+ screen-resolution-extra==0.0.0
346
+ scs==3.2.0
347
+ seaborn==0.11.2
348
+ Send2Trash==1.8.0
349
+ setuptools-git==1.2
350
+ Shapely==1.8.4
351
+ six==1.15.0
352
+ sklearn-pandas==1.8.0
353
+ smart-open==5.2.1
354
+ sniffio==1.3.0
355
+ snowballstemmer==2.2.0
356
+ sortedcontainers==2.4.0
357
+ soundfile==0.11.0
358
+ spacy==3.4.1
359
+ spacy-legacy==3.0.10
360
+ spacy-loggers==1.0.3
361
+ Sphinx==1.8.6
362
+ sphinxcontrib-serializinghtml==1.1.5
363
+ sphinxcontrib-websupport==1.2.4
364
+ SQLAlchemy==1.4.41
365
+ sqlparse==0.4.3
366
+ srsly==2.4.4
367
+ starlette==0.20.4
368
+ statsmodels==0.12.2
369
+ sympy==1.7.1
370
+ tables==3.7.0
371
+ tabulate==0.8.10
372
+ tblib==1.7.0
373
+ tenacity==8.1.0
374
+ tensorboard==2.8.0
375
+ tensorboard-data-server==0.6.1
376
+ tensorboard-plugin-wit==1.8.1
377
+ tensorflow==2.8.2+zzzcolab20220929150707
378
+ tensorflow-datasets==4.6.0
379
+ tensorflow-estimator==2.8.0
380
+ tensorflow-gcs-config==2.8.0
381
+ tensorflow-hub==0.12.0
382
+ tensorflow-io-gcs-filesystem==0.27.0
383
+ tensorflow-metadata==1.10.0
384
+ tensorflow-probability==0.16.0
385
+ termcolor==2.0.1
386
+ terminado==0.13.3
387
+ testpath==0.6.0
388
+ text-unidecode==1.3
389
+ textblob==0.15.3
390
+ thinc==8.1.2
391
+ threadpoolctl==3.1.0
392
+ tifffile==2021.11.2
393
+ tokenizers==0.12.1
394
+ toml==0.10.2
395
+ tomli==2.0.1
396
+ toolz==0.12.0
397
+ torch @ https://download.pytorch.org/whl/cu113/torch-1.12.1%2Bcu113-cp37-cp37m-linux_x86_64.whl
398
+ torchaudio @ https://download.pytorch.org/whl/cu113/torchaudio-0.12.1%2Bcu113-cp37-cp37m-linux_x86_64.whl
399
+ torchsummary==1.5.1
400
+ torchtext==0.13.1
401
+ torchvision @ https://download.pytorch.org/whl/cu113/torchvision-0.13.1%2Bcu113-cp37-cp37m-linux_x86_64.whl
402
+ tornado==5.1.1
403
+ tqdm==4.64.1
404
+ traitlets==5.1.1
405
+ transformers==4.22.2
406
+ tweepy==3.10.0
407
+ typeguard==2.7.1
408
+ typer==0.4.2
409
+ typing-extensions==4.1.1
410
+ tzlocal==1.5.1
411
+ uc-micro-py==1.0.1
412
+ ujson==5.5.0
413
+ uritemplate==3.0.1
414
+ urllib3==1.25.11
415
+ uvicorn==0.18.3
416
+ vega-datasets==0.9.0
417
+ wasabi==0.10.1
418
+ wcwidth==0.2.5
419
+ webargs==8.2.0
420
+ webencodings==0.5.1
421
+ websockets==10.3
422
+ Werkzeug==1.0.1
423
+ widgetsnbextension==3.6.1
424
+ wordcloud==1.8.2.2
425
+ wrapt==1.14.1
426
+ xarray==0.20.2
427
+ xarray-einstats==0.2.2
428
+ xgboost==0.90
429
+ xkit==0.0.0
430
+ xlrd==1.1.0
431
+ xlwt==1.3.0
432
+ xxhash==3.0.0
433
+ yarl==1.8.1
434
+ yellowbrick==1.5
435
+ zict==2.2.0
436
+ zipp==3.8.1
saved_model_files/.DS_Store ADDED
Binary file (6.15 kB). View file
 
saved_model_files/config.json ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "google/vit-base-patch16-224",
3
+ "architectures": [
4
+ "ViTForImageClassification"
5
+ ],
6
+ "attention_probs_dropout_prob": 0.0,
7
+ "encoder_stride": 16,
8
+ "hidden_act": "gelu",
9
+ "hidden_dropout_prob": 0.0,
10
+ "hidden_size": 768,
11
+ "id2label": {
12
+ "0": "angular_leaf_spot",
13
+ "1": "bean_rust",
14
+ "2": "healthy"
15
+ },
16
+ "image_size": 224,
17
+ "initializer_range": 0.02,
18
+ "intermediate_size": 3072,
19
+ "label2id": {
20
+ "angular_leaf_spot": "0",
21
+ "bean_rust": "1",
22
+ "healthy": "2"
23
+ },
24
+ "layer_norm_eps": 1e-12,
25
+ "model_type": "vit",
26
+ "num_attention_heads": 12,
27
+ "num_channels": 3,
28
+ "num_hidden_layers": 12,
29
+ "patch_size": 16,
30
+ "problem_type": "single_label_classification",
31
+ "qkv_bias": true,
32
+ "torch_dtype": "float32",
33
+ "transformers_version": "4.22.2"
34
+ }
saved_model_files/preprocessor_config.json ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "do_normalize": true,
3
+ "do_resize": true,
4
+ "feature_extractor_type": "ViTFeatureExtractor",
5
+ "image_mean": [
6
+ 0.5,
7
+ 0.5,
8
+ 0.5
9
+ ],
10
+ "image_std": [
11
+ 0.5,
12
+ 0.5,
13
+ 0.5
14
+ ],
15
+ "resample": 2,
16
+ "size": 224
17
+ }
saved_model_files/pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1544bd049155d33a8bd6e3e6f90fe34197403c925bd38c8ace5091479952080d
3
+ size 343270065
saved_model_files/training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6ee592c0d94564ee3bffdde318a595c528aaf89d2a6104f078687478119c9912
3
+ size 3375