Ruslan Zitser commited on
Commit
0d4f69b
·
1 Parent(s): a6f680a

creae Dockerfile, update autotab_app relative paths in param.py, decreseasing requirements.txt

Browse files
Files changed (4) hide show
  1. Dockerfile +4 -1
  2. autotab/param.py +7 -2
  3. requirements.txt +112 -112
  4. streamlit/autotab_app.py +20 -15
Dockerfile CHANGED
@@ -11,8 +11,11 @@ COPY README.md /README.md
11
  COPY Procfile /Procfile
12
  COPY requirements.txt /requirements.txt
13
  COPY setup.py /setup.py
 
14
 
15
  RUN pip install --upgrade pip
16
  RUN pip install -r requirements.txt
 
 
17
 
18
- CMD uvicorn api.simple:app --host 0.0.0.0 --port $PORT
 
11
  COPY Procfile /Procfile
12
  COPY requirements.txt /requirements.txt
13
  COPY setup.py /setup.py
14
+ COPY api/api_app.py /api/api_app.py
15
 
16
  RUN pip install --upgrade pip
17
  RUN pip install -r requirements.txt
18
+ RUN apt-get update -y && apt-get install -y --no-install-recommends build-essential gcc \
19
+ libsndfile1
20
 
21
+ CMD uvicorn api.api_app:app --host 0.0.0.0 --port $PORT
autotab/param.py CHANGED
@@ -1,7 +1,12 @@
1
  ###### ENVIRONMENT VARIABLES FOR AUTOTAB #########
 
2
 
3
  GCP = True
4
  BUCKET_NAME = "wagon-data-737-sadriwala"
5
  DATA_BUCKET_FOLDER = "data/spec_repr"
6
- LOCAL_DATA = "/mnt/d/data-science/le-wagon/autotab/data/spec_repr/"
7
- LOCAL_MODEL = "/mnt/d/data-science/le-wagon/autotab/h5-model/full_val0_75acc_weights.h5"
 
 
 
 
 
1
  ###### ENVIRONMENT VARIABLES FOR AUTOTAB #########
2
+ import os
3
 
4
  GCP = True
5
  BUCKET_NAME = "wagon-data-737-sadriwala"
6
  DATA_BUCKET_FOLDER = "data/spec_repr"
7
+ LOCAL_DATA = os.path.abspath("data/spec_repr") + "/"
8
+ LOCAL_MODEL = os.path.abspath("h5-model/full_val0_75acc_weights.h5")
9
+
10
+ if __name__== '__main__':
11
+ print(LOCAL_DATA)
12
+ print(LOCAL_MODEL)
requirements.txt CHANGED
@@ -10,128 +10,128 @@ streamlit
10
  # data science
11
  numpy
12
  pandas
13
- scikit-learn
14
  tensorflow
15
 
16
- # tests/linter #optional
17
- black
18
- coverage
19
- flake8
20
- pytest
21
- yapf
22
 
23
- # API #optional
24
- gcsfs
25
- mlflow
26
- s3fs
27
 
28
- # utilities #optional
29
- six>=1.14
30
- joblib
31
- memoized-property
32
- termcolor
33
 
34
  #guitar-set #primary
35
  librosa
36
  jams
37
  sox
38
 
39
- #installed as minimal packages by Le Wagon #optional
40
- anyio
41
- argon2-cffi
42
- astroid
43
- attrs
44
- Babel
45
- backcall
46
- bleach
47
- certifi
48
- cffi
49
- charset-normalizer
50
- cycler
51
- debugpy
52
- decorator
53
- defusedxml
54
- entrypoints
55
- fonttools
56
- idna
57
- importlib-resources
58
- iniconfig
59
- ipdb
60
- ipykernel
61
- ipython
62
- ipython-genutils
63
- isort
64
- jedi
65
- Jinja2
66
- joblib
67
- json5
68
- jsonschema
69
- jupyter-client
70
- jupyter-core
71
- jupyter-server
72
- jupyterlab
73
- jupyterlab-pygments
74
- jupyterlab-server
75
- kiwisolver
76
- lazy-object-proxy
77
- MarkupSafe
78
- matplotlib
79
- matplotlib-inline
80
- mccabe
81
- mistune
82
- nbclassic
83
- nbclient
84
- nbconvert
85
- nbformat
86
- nest-asyncio
87
- notebook
88
- numpy
89
- packaging
90
- pandas
91
- pandocfilters
92
- parso
93
- pexpect
94
- pickleshare
95
- Pillow
96
- pip
97
- platformdirs
98
- pluggy
99
- prometheus-client
100
- prompt-toolkit
101
- ptyprocess
102
- py
103
- pycparser
104
- Pygments
105
- pylint
106
- pyparsing
107
- pyrsistent
108
- pytest
109
- python-dateutil
110
- pytz
111
- pyzmq
112
- requests
113
- scikit-learn
114
- scipy
115
- seaborn
116
- Send2Trash
117
- setuptools
118
- setuptools-scm
119
- six
120
- sniffio
121
- terminado
122
- testpath
123
- threadpoolctl
124
- toml
125
- tomli
126
- tornado
127
- traitlets
128
- typing_extensions
129
- urllib3
130
- wcwidth
131
- webencodings
132
- websocket-client
133
- wrapt
134
- zipp
135
 
136
  uvicorn
137
  fastapi
 
10
  # data science
11
  numpy
12
  pandas
13
+ # scikit-learn
14
  tensorflow
15
 
16
+ # # tests/linter #optional
17
+ # black
18
+ # coverage
19
+ # flake8
20
+ # pytest
21
+ # yapf
22
 
23
+ # # API #optional
24
+ # gcsfs
25
+ # mlflow
26
+ # s3fs
27
 
28
+ # # utilities #optional
29
+ # six>=1.14
30
+ # joblib
31
+ # memoized-property
32
+ # termcolor
33
 
34
  #guitar-set #primary
35
  librosa
36
  jams
37
  sox
38
 
39
+ # #installed as minimal packages by Le Wagon #optional
40
+ # anyio
41
+ # argon2-cffi
42
+ # astroid
43
+ # attrs
44
+ # Babel
45
+ # backcall
46
+ # bleach
47
+ # certifi
48
+ # cffi
49
+ # charset-normalizer
50
+ # cycler
51
+ # debugpy
52
+ # decorator
53
+ # defusedxml
54
+ # entrypoints
55
+ # fonttools
56
+ # idna
57
+ # importlib-resources
58
+ # iniconfig
59
+ # ipdb
60
+ # ipykernel
61
+ # ipython
62
+ # ipython-genutils
63
+ # isort
64
+ # jedi
65
+ # Jinja2
66
+ # joblib
67
+ # json5
68
+ # jsonschema
69
+ # jupyter-client
70
+ # jupyter-core
71
+ # jupyter-server
72
+ # jupyterlab
73
+ # jupyterlab-pygments
74
+ # jupyterlab-server
75
+ # kiwisolver
76
+ # lazy-object-proxy
77
+ # MarkupSafe
78
+ # matplotlib
79
+ # matplotlib-inline
80
+ # mccabe
81
+ # mistune
82
+ # nbclassic
83
+ # nbclient
84
+ # nbconvert
85
+ # nbformat
86
+ # nest-asyncio
87
+ # notebook
88
+ # numpy
89
+ # packaging
90
+ # pandas
91
+ # pandocfilters
92
+ # parso
93
+ # pexpect
94
+ # pickleshare
95
+ # Pillow
96
+ # pip
97
+ # platformdirs
98
+ # pluggy
99
+ # prometheus-client
100
+ # prompt-toolkit
101
+ # ptyprocess
102
+ # py
103
+ # pycparser
104
+ # Pygments
105
+ # pylint
106
+ # pyparsing
107
+ # pyrsistent
108
+ # pytest
109
+ # python-dateutil
110
+ # pytz
111
+ # pyzmq
112
+ # requests
113
+ # scikit-learn
114
+ # scipy
115
+ # seaborn
116
+ # Send2Trash
117
+ # setuptools
118
+ # setuptools-scm
119
+ # six
120
+ # sniffio
121
+ # terminado
122
+ # testpath
123
+ # threadpoolctl
124
+ # toml
125
+ # tomli
126
+ # tornado
127
+ # traitlets
128
+ # typing_extensions
129
+ # urllib3
130
+ # wcwidth
131
+ # webencodings
132
+ # websocket-client
133
+ # wrapt
134
+ # zipp
135
 
136
  uvicorn
137
  fastapi
streamlit/autotab_app.py CHANGED
@@ -5,7 +5,6 @@ import pandas as pd
5
  import numpy as np
6
  from autotab.TabDataReprGen import TabDataReprGen
7
  from PIL import Image
8
- import base64
9
 
10
  st.set_page_config(
11
  page_title="AutoTab tab generator",
@@ -43,29 +42,34 @@ CSS = """
43
  """
44
  st.write(f'<style>{CSS}</style>', unsafe_allow_html=True)
45
 
46
- # st.title('Model')
47
-
48
- model = tp.load_model_and_weights()
49
- model.load_weights('./h5-model/full_val0_75acc_weights.h5')
50
-
51
- # st.write(model.weights[0].shape)
52
 
53
  st.set_option('deprecation.showfileUploaderEncoding', False)
54
 
55
  uploaded_file = st.file_uploader("choose a music file:", type="wav")
56
 
 
 
57
  mode = st.radio('Choose Mode of Tab production:', ('squeezed notes', 'changed notes'))
58
  st.write('<style>div.row-widget.stRadio > div{flex-direction:row;}</style>', unsafe_allow_html=True)
59
 
 
 
 
60
 
 
 
 
 
 
61
  if uploaded_file is not None and mode == 'squeezed notes':
62
  st.title("""
63
  The predicted squeezed Tabs:
64
  """)
65
- genrep = TabDataReprGen()
66
- x_new = genrep.load_rep_from_raw_file(uploaded_file)
67
- # st.write(x_new.shape)
68
- y_pred = model.predict(x_new)
 
69
 
70
  expanded_tab = tp.make_full_tab(y_pred, len(y_pred))
71
  display_tab = tp.make_squeezed_tab(expanded_tab)
@@ -75,10 +79,11 @@ if uploaded_file is not None and mode == 'changed notes':
75
  st.title("""
76
  The predicted changed notes Tabs:
77
  """)
78
- genrep = TabDataReprGen()
79
- x_new = genrep.load_rep_from_raw_file(uploaded_file)
80
- # st.write(x_new.shape)
81
- y_pred = model.predict(x_new)
 
82
 
83
  expanded_tab = tp.make_full_tab(y_pred, len(y_pred))
84
  display_tab = tp.make_dynamic_tab(expanded_tab)
 
5
  import numpy as np
6
  from autotab.TabDataReprGen import TabDataReprGen
7
  from PIL import Image
 
8
 
9
  st.set_page_config(
10
  page_title="AutoTab tab generator",
 
42
  """
43
  st.write(f'<style>{CSS}</style>', unsafe_allow_html=True)
44
 
 
 
 
 
 
 
45
 
46
  st.set_option('deprecation.showfileUploaderEncoding', False)
47
 
48
  uploaded_file = st.file_uploader("choose a music file:", type="wav")
49
 
50
+ processed_file = None
51
+
52
  mode = st.radio('Choose Mode of Tab production:', ('squeezed notes', 'changed notes'))
53
  st.write('<style>div.row-widget.stRadio > div{flex-direction:row;}</style>', unsafe_allow_html=True)
54
 
55
+ model = tp.load_model_and_weights()
56
+ model.load_weights('./h5-model/full_val0_75acc_weights.h5')
57
+ genrep = TabDataReprGen()
58
 
59
+ if uploaded_file is not None:
60
+ x_new = genrep.load_rep_from_raw_file(uploaded_file)
61
+ y_pred = model.predict(x_new)
62
+ processed_file= uploaded_file
63
+
64
  if uploaded_file is not None and mode == 'squeezed notes':
65
  st.title("""
66
  The predicted squeezed Tabs:
67
  """)
68
+ if uploaded_file != processed_file:
69
+ x_new = genrep.load_rep_from_raw_file(uploaded_file)
70
+ # st.write(x_new.shape)
71
+ y_pred = model.predict(x_new)
72
+ processed_file = uploaded_file
73
 
74
  expanded_tab = tp.make_full_tab(y_pred, len(y_pred))
75
  display_tab = tp.make_squeezed_tab(expanded_tab)
 
79
  st.title("""
80
  The predicted changed notes Tabs:
81
  """)
82
+ if uploaded_file != processed_file:
83
+ x_new = genrep.load_rep_from_raw_file(uploaded_file)
84
+ # st.write(x_new.shape)
85
+ y_pred = model.predict(x_new)
86
+ processed_file = uploaded_file
87
 
88
  expanded_tab = tp.make_full_tab(y_pred, len(y_pred))
89
  display_tab = tp.make_dynamic_tab(expanded_tab)