viktor-kertanov commited on
Commit
3fb3192
·
1 Parent(s): 16f6f46

painters app second attempt

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ paintings_examples/*.jpeg filter=lfs diff=lfs merge=lfs -text
.gitignore ADDED
@@ -0,0 +1 @@
 
 
1
+ env
app.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from fastai.vision.all import *
3
+ import os
4
+
5
+ learn = load_learner('painters_model.pkl')
6
+
7
+ painters_categories = list(learn.dls.vocab)
8
+
9
+ def classify_image(img):
10
+ '''Image classifications'''
11
+ pred, idx, probs = learn.predict(img)
12
+ return dict(zip(painters_categories, map(float, probs)))
13
+
14
+ image = gr.components.Image(shape=(192, 192))
15
+ label = gr.components.Label()
16
+ examples_dir = 'paintings_examples'
17
+
18
+ examples = [os.path.join(examples_dir, file) for file in os.listdir(examples_dir)]
19
+
20
+ intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
21
+ intf.launch(inline=False)
painters.ipynb ADDED
The diff for this file is too large to render. See raw diff
 
painters_model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b0ca9e9f65349a5b7eefd2422c87a52c61bdc2d9887152189ae855a8648f269e
3
+ size 47002118
paintings_examples/cz1.jpeg ADDED

Git LFS Details

  • SHA256: 4077863f52b33c2e04861d0906431a6e762ac6ab74762fd1cddb7e3b8669e23a
  • Pointer size: 131 Bytes
  • Size of remote file: 248 kB
paintings_examples/cz2.jpeg ADDED

Git LFS Details

  • SHA256: 7888178737b697568c697f477f7a8df86298154ef3ca530dc3be28133143527c
  • Pointer size: 131 Bytes
  • Size of remote file: 192 kB
paintings_examples/monet1.jpeg ADDED

Git LFS Details

  • SHA256: 147b28d6f0dc527ae5f8efc5d7318c163d376c7c9495dd89e4533bc0f80233ea
  • Pointer size: 131 Bytes
  • Size of remote file: 119 kB
paintings_examples/monet2.jpeg ADDED

Git LFS Details

  • SHA256: 5edd49a42638c994021ae1641aa600bdbb571d3bd85c6a7de6b420b4194084bb
  • Pointer size: 132 Bytes
  • Size of remote file: 1.36 MB
paintings_examples/pissarro1.jpeg ADDED

Git LFS Details

  • SHA256: 8d881d4148819e8f32044a20092b234898b89dc90faff7997da018fc82f8be03
  • Pointer size: 131 Bytes
  • Size of remote file: 451 kB
paintings_examples/renoir_2.jpeg ADDED

Git LFS Details

  • SHA256: 5f8d52c500e39417f05aaf402c5e07878c544f5319f4a5596a10f18a7756d3bc
  • Pointer size: 131 Bytes
  • Size of remote file: 186 kB
paintings_examples/renoir_3.jpeg ADDED

Git LFS Details

  • SHA256: 7bc1ca504d428b3b97beae1f3f895437d70cda4e0461324275c57f31665a3363
  • Pointer size: 131 Bytes
  • Size of remote file: 247 kB
paintings_examples/vg1.jpeg ADDED

Git LFS Details

  • SHA256: 4b43430b56cf5e99cbbcffc10ce218fc9214a4907c77ddd0c620530f3cdbea48
  • Pointer size: 131 Bytes
  • Size of remote file: 277 kB
requirements.txt ADDED
@@ -0,0 +1,168 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ aiofiles==23.1.0
2
+ aiohttp==3.8.4
3
+ aiosignal==1.3.1
4
+ altair==5.0.1
5
+ annotated-types==0.5.0
6
+ anyio==3.7.1
7
+ appnope==0.1.3
8
+ argon2-cffi==21.3.0
9
+ argon2-cffi-bindings==21.2.0
10
+ arrow==1.2.3
11
+ asttokens==2.2.1
12
+ async-timeout==4.0.2
13
+ attrs==23.1.0
14
+ backcall==0.2.0
15
+ beautifulsoup4==4.12.2
16
+ bleach==6.0.0
17
+ blis==0.7.9
18
+ catalogue==2.0.8
19
+ certifi==2023.5.7
20
+ cffi==1.15.1
21
+ charset-normalizer==3.2.0
22
+ click==8.1.4
23
+ comm==0.1.3
24
+ confection==0.1.0
25
+ contourpy==1.1.0
26
+ cycler==0.11.0
27
+ cymem==2.0.7
28
+ debugpy==1.6.7
29
+ decorator==5.1.1
30
+ defusedxml==0.7.1
31
+ executing==1.2.0
32
+ fastai==2.7.12
33
+ fastapi==0.100.0
34
+ fastcore==1.5.29
35
+ fastdownload==0.0.7
36
+ fastjsonschema==2.17.1
37
+ fastprogress==1.0.3
38
+ ffmpy==0.3.0
39
+ filelock==3.12.2
40
+ fonttools==4.40.0
41
+ fqdn==1.5.1
42
+ frozenlist==1.3.3
43
+ fsspec==2023.6.0
44
+ gradio==3.36.1
45
+ gradio_client==0.2.8
46
+ h11==0.14.0
47
+ httpcore==0.17.3
48
+ httpx==0.24.1
49
+ huggingface-hub==0.16.4
50
+ idna==3.4
51
+ ipykernel==6.24.0
52
+ ipython==8.14.0
53
+ ipython-genutils==0.2.0
54
+ ipywidgets==8.0.7
55
+ isoduration==20.11.0
56
+ jedi==0.18.2
57
+ Jinja2==3.1.2
58
+ joblib==1.3.1
59
+ jsonpointer==2.4
60
+ jsonschema==4.18.0
61
+ jsonschema-specifications==2023.6.1
62
+ jupyter==1.0.0
63
+ jupyter-console==6.6.3
64
+ jupyter-events==0.6.3
65
+ jupyter_client==8.3.0
66
+ jupyter_core==5.3.1
67
+ jupyter_server==2.7.0
68
+ jupyter_server_terminals==0.4.4
69
+ jupyterlab-pygments==0.2.2
70
+ jupyterlab-widgets==3.0.8
71
+ kiwisolver==1.4.4
72
+ langcodes==3.3.0
73
+ linkify-it-py==2.0.2
74
+ markdown-it-py==2.2.0
75
+ MarkupSafe==2.1.3
76
+ matplotlib==3.7.2
77
+ matplotlib-inline==0.1.6
78
+ mdit-py-plugins==0.3.3
79
+ mdurl==0.1.2
80
+ mistune==3.0.1
81
+ mpmath==1.3.0
82
+ multidict==6.0.4
83
+ murmurhash==1.0.9
84
+ nbclassic==1.0.0
85
+ nbclient==0.8.0
86
+ nbconvert==7.6.0
87
+ nbformat==5.9.1
88
+ nest-asyncio==1.5.6
89
+ networkx==3.1
90
+ notebook==6.5.4
91
+ notebook_shim==0.2.3
92
+ numpy==1.25.1
93
+ orjson==3.9.2
94
+ overrides==7.3.1
95
+ packaging==23.1
96
+ pandas==2.0.3
97
+ pandocfilters==1.5.0
98
+ parso==0.8.3
99
+ pathy==0.10.2
100
+ pexpect==4.8.0
101
+ pickleshare==0.7.5
102
+ Pillow==10.0.0
103
+ platformdirs==3.8.1
104
+ preshed==3.0.8
105
+ prometheus-client==0.17.1
106
+ prompt-toolkit==3.0.39
107
+ psutil==5.9.5
108
+ ptyprocess==0.7.0
109
+ pure-eval==0.2.2
110
+ pycparser==2.21
111
+ pydantic==1.10.11
112
+ pydantic_core==2.1.2
113
+ pydub==0.25.1
114
+ Pygments==2.15.1
115
+ pyparsing==3.0.9
116
+ python-dateutil==2.8.2
117
+ python-json-logger==2.0.7
118
+ python-multipart==0.0.6
119
+ pytz==2023.3
120
+ PyYAML==6.0
121
+ pyzmq==25.1.0
122
+ qtconsole==5.4.3
123
+ QtPy==2.3.1
124
+ referencing==0.29.1
125
+ requests==2.31.0
126
+ rfc3339-validator==0.1.4
127
+ rfc3986-validator==0.1.1
128
+ rpds-py==0.8.10
129
+ scikit-learn==1.3.0
130
+ scipy==1.11.1
131
+ semantic-version==2.10.0
132
+ Send2Trash==1.8.2
133
+ six==1.16.0
134
+ smart-open==6.3.0
135
+ sniffio==1.3.0
136
+ soupsieve==2.4.1
137
+ spacy==3.6.0
138
+ spacy-legacy==3.0.12
139
+ spacy-loggers==1.0.4
140
+ srsly==2.4.6
141
+ stack-data==0.6.2
142
+ starlette==0.27.0
143
+ sympy==1.12
144
+ terminado==0.17.1
145
+ thinc==8.1.10
146
+ threadpoolctl==3.1.0
147
+ tinycss2==1.2.1
148
+ toolz==0.12.0
149
+ torch==2.0.1
150
+ torchvision==0.15.2
151
+ tornado==6.3.2
152
+ tqdm==4.65.0
153
+ traitlets==5.9.0
154
+ typer==0.9.0
155
+ typing_extensions==4.7.1
156
+ tzdata==2023.3
157
+ uc-micro-py==1.0.2
158
+ uri-template==1.3.0
159
+ urllib3==2.0.3
160
+ uvicorn==0.22.0
161
+ wasabi==1.1.2
162
+ wcwidth==0.2.6
163
+ webcolors==1.13
164
+ webencodings==0.5.1
165
+ websocket-client==1.6.1
166
+ websockets==11.0.3
167
+ widgetsnbextension==4.0.8
168
+ yarl==1.9.2