OnurKerimoglu commited on
Commit
ec3efc2
·
1 Parent(s): 12ce396

First deployment with EDA_CNN.h5 model trained on kaggle dataset

Browse files
Files changed (10) hide show
  1. Angry.png +0 -0
  2. Disgust.png +0 -0
  3. Fear.png +0 -0
  4. Happy.png +0 -0
  5. Neutral.png +0 -0
  6. Sad.png +0 -0
  7. Surprise.png +0 -0
  8. kerasgradioapp.py +31 -0
  9. models/EDA_CNN.h5 +3 -0
  10. requirements.txt +210 -0
Angry.png ADDED
Disgust.png ADDED
Fear.png ADDED
Happy.png ADDED
Neutral.png ADDED
Sad.png ADDED
Surprise.png ADDED
kerasgradioapp.py ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import gradio as gr
3
+ import numpy as np
4
+ from keras.models import load_model
5
+ from keras.utils import load_img, img_to_array
6
+ from tensorflow.image import resize
7
+
8
+ #gradio interface
9
+ def classify_image(image):
10
+ input_arr = img_to_array(image) #turn to grayscale
11
+ input_arr_resh = resize(input_arr, (48, 48)).numpy()
12
+ input_arr_resh_gray = input_arr_resh.mean(axis=2).reshape(48,48,1)
13
+ predictions = model.predict(np.array([input_arr_resh_gray]))
14
+ emotions = {0: 'Angry', 1: 'Disgust', 2: 'Fear', 3: 'Happy', 4: 'Sad', 5: 'Surprise', 6: 'Neutral'}
15
+ pr_emotion = emotions[predictions.argmax()]
16
+ prob = predictions.max()*100
17
+ return f'Prediction: {pr_emotion}, probability:{prob:4.1f}'
18
+
19
+ model = load_model(os.path.join("models","EDA_CNN.h5"))
20
+ image = gr.inputs.Image(shape=(48,48))
21
+ label = gr.outputs.Label()
22
+ examples = ['Happy.png',
23
+ 'Surprise.png',
24
+ 'Neutral.png',
25
+ 'Sad.png',
26
+ 'Angry.png',
27
+ 'Disgust.png',
28
+ 'Fear.png']
29
+
30
+ intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
31
+ intf.launch(inline=False)
models/EDA_CNN.h5 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6d478dc8dfa16106ad23a5d5daf72e3cb78a8dd937c87f94d4678e3f9c84e128
3
+ size 3869176
requirements.txt ADDED
@@ -0,0 +1,210 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ absl-py==1.4.0
2
+ aiohttp==3.8.3
3
+ aiosignal==1.3.1
4
+ altair==4.2.0
5
+ anyio==3.6.2
6
+ argon2-cffi==21.3.0
7
+ argon2-cffi-bindings==21.2.0
8
+ arrow==1.2.3
9
+ asttokens==2.2.1
10
+ astunparse==1.6.3
11
+ async-timeout==4.0.2
12
+ attrs==22.2.0
13
+ backcall==0.2.0
14
+ beautifulsoup4==4.11.1
15
+ bleach==5.0.1
16
+ blis==0.7.9
17
+ cachetools==5.2.1
18
+ catalogue==2.0.8
19
+ certifi==2022.12.7
20
+ cffi==1.15.1
21
+ charset-normalizer==2.1.1
22
+ click==8.1.3
23
+ comm==0.1.2
24
+ confection==0.0.4
25
+ contourpy==1.0.6
26
+ cycler==0.11.0
27
+ cymem==2.0.7
28
+ datasets==2.8.0
29
+ debugpy==1.6.5
30
+ decorator==5.1.1
31
+ defusedxml==0.7.1
32
+ dill==0.3.6
33
+ entrypoints==0.4
34
+ execnb==0.1.4
35
+ executing==1.2.0
36
+ fastai==2.7.10
37
+ fastapi==0.89.1
38
+ fastbook==0.0.29
39
+ fastcore==1.5.27
40
+ fastdownload==0.0.7
41
+ fastjsonschema==2.16.2
42
+ fastprogress==1.0.3
43
+ ffmpy==0.3.0
44
+ filelock==3.9.0
45
+ flatbuffers==23.1.4
46
+ fonttools==4.38.0
47
+ fqdn==1.5.1
48
+ frozenlist==1.3.3
49
+ fsspec==2022.11.0
50
+ gast==0.4.0
51
+ ghapi==1.0.3
52
+ google-auth==2.16.0
53
+ google-auth-oauthlib==0.4.6
54
+ google-pasta==0.2.0
55
+ gradio==3.16.1
56
+ graphviz==0.20.1
57
+ grpcio==1.51.1
58
+ h11==0.14.0
59
+ h5py==3.7.0
60
+ httpcore==0.16.3
61
+ httpx==0.23.3
62
+ huggingface-hub==0.11.1
63
+ idna==3.4
64
+ importlib-metadata==6.0.0
65
+ ipykernel==6.20.1
66
+ ipython==8.8.0
67
+ ipython-genutils==0.2.0
68
+ ipywidgets==7.7.2
69
+ isoduration==20.11.0
70
+ jedi==0.18.2
71
+ Jinja2==3.1.2
72
+ joblib==1.2.0
73
+ jsonpointer==2.3
74
+ jsonschema==4.17.3
75
+ jupyter-contrib-core==0.4.2
76
+ jupyter-contrib-nbextensions==0.7.0
77
+ jupyter-events==0.6.2
78
+ jupyter-highlight-selected-word==0.2.0
79
+ jupyter-nbextensions-configurator==0.6.1
80
+ jupyter_client==7.4.8
81
+ jupyter_core==5.1.3
82
+ jupyter_server==2.0.6
83
+ jupyter_server_terminals==0.4.4
84
+ jupyterlab-pygments==0.2.2
85
+ jupyterlab-widgets==1.1.1
86
+ keras==2.11.0
87
+ kiwisolver==1.4.4
88
+ langcodes==3.3.0
89
+ libclang==15.0.6.1
90
+ linkify-it-py==1.0.3
91
+ lxml==4.9.2
92
+ Markdown==3.4.1
93
+ markdown-it-py==2.1.0
94
+ MarkupSafe==2.1.1
95
+ matplotlib==3.6.3
96
+ matplotlib-inline==0.1.6
97
+ mdit-py-plugins==0.3.3
98
+ mdurl==0.1.2
99
+ mistune==2.0.4
100
+ multidict==6.0.4
101
+ multiprocess==0.70.14
102
+ murmurhash==1.0.9
103
+ nbclassic==0.4.8
104
+ nbclient==0.7.2
105
+ nbconvert==7.2.7
106
+ nbdev==2.3.9
107
+ nbformat==5.7.3
108
+ nest-asyncio==1.5.6
109
+ notebook==6.5.2
110
+ notebook_shim==0.2.2
111
+ numpy==1.24.1
112
+ nvidia-cublas-cu11==11.10.3.66
113
+ nvidia-cuda-nvrtc-cu11==11.7.99
114
+ nvidia-cuda-runtime-cu11==11.7.99
115
+ nvidia-cudnn-cu11==8.5.0.96
116
+ oauthlib==3.2.2
117
+ opt-einsum==3.3.0
118
+ orjson==3.8.5
119
+ packaging==23.0
120
+ pandas==1.5.2
121
+ pandocfilters==1.5.0
122
+ parso==0.8.3
123
+ pathy==0.10.1
124
+ pexpect==4.8.0
125
+ pickleshare==0.7.5
126
+ Pillow==9.4.0
127
+ platformdirs==2.6.2
128
+ preshed==3.0.8
129
+ prometheus-client==0.15.0
130
+ prompt-toolkit==3.0.36
131
+ protobuf==3.19.6
132
+ psutil==5.9.4
133
+ ptyprocess==0.7.0
134
+ pure-eval==0.2.2
135
+ pyarrow==10.0.1
136
+ pyasn1==0.4.8
137
+ pyasn1-modules==0.2.8
138
+ pycparser==2.21
139
+ pycryptodome==3.16.0
140
+ pydantic==1.10.4
141
+ pydub==0.25.1
142
+ Pygments==2.14.0
143
+ pyparsing==3.0.9
144
+ pyrsistent==0.19.3
145
+ python-dateutil==2.8.2
146
+ python-json-logger==2.0.4
147
+ python-multipart==0.0.5
148
+ pytz==2022.7
149
+ PyYAML==6.0
150
+ pyzmq==25.0.0
151
+ regex==2022.10.31
152
+ requests==2.28.1
153
+ requests-oauthlib==1.3.1
154
+ responses==0.18.0
155
+ rfc3339-validator==0.1.4
156
+ rfc3986==1.5.0
157
+ rfc3986-validator==0.1.1
158
+ rsa==4.9
159
+ scikit-learn==1.2.0
160
+ scipy==1.10.0
161
+ Send2Trash==1.8.0
162
+ sentencepiece==0.1.97
163
+ six==1.16.0
164
+ smart-open==6.3.0
165
+ sniffio==1.3.0
166
+ soupsieve==2.3.2.post1
167
+ spacy==3.4.4
168
+ spacy-legacy==3.0.11
169
+ spacy-loggers==1.0.4
170
+ srsly==2.4.5
171
+ stack-data==0.6.2
172
+ starlette==0.22.0
173
+ tensorboard==2.11.2
174
+ tensorboard-data-server==0.6.1
175
+ tensorboard-plugin-wit==1.8.1
176
+ tensorflow==2.11.0
177
+ tensorflow-estimator==2.11.0
178
+ tensorflow-io-gcs-filesystem==0.29.0
179
+ termcolor==2.2.0
180
+ terminado==0.17.1
181
+ thinc==8.1.6
182
+ threadpoolctl==3.1.0
183
+ tinycss2==1.2.1
184
+ tokenizers==0.13.2
185
+ toolz==0.12.0
186
+ torch==1.13.1
187
+ torchvision==0.14.1
188
+ tornado==6.2
189
+ tqdm==4.64.1
190
+ traitlets==5.8.1
191
+ transformers==4.25.1
192
+ typer==0.7.0
193
+ typing_extensions==4.4.0
194
+ uc-micro-py==1.0.1
195
+ uri-template==1.2.0
196
+ urllib3==1.26.14
197
+ uvicorn==0.20.0
198
+ wasabi==0.10.1
199
+ watchdog==2.2.1
200
+ wcwidth==0.2.5
201
+ webcolors==1.12
202
+ webencodings==0.5.1
203
+ websocket-client==1.4.2
204
+ websockets==10.4
205
+ Werkzeug==2.2.2
206
+ widgetsnbextension==3.6.1
207
+ wrapt==1.14.1
208
+ xxhash==3.2.0
209
+ yarl==1.8.2
210
+ zipp==3.11.0