Spaces:
Sleeping
Sleeping
File size: 14,947 Bytes
191195c 1dd67b4 191195c 1dd67b4 191195c 1dd67b4 191195c 1dd67b4 191195c 1dd67b4 191195c 1dd67b4 191195c 1dd67b4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 |
import streamlit as st
import os
ROOT_FIG_DIR = f'{os.getcwd()}/figures/'
def get_product_dev_page_layout():
model_details ={
"Model Description": "[EfficientNet](https://arxiv.org/abs/1905.11946) is used for transfer learning.",
"Model Type": "Convolutional Neural Nets",
}
dev_details = {
"Training Framework": "Tensorflow Keras",
"Backbone Architeture":"EfficientNetB4",
"Number of classes":4,
"Number of training epochs": 10,
"Dropout rate": 0.2,
"batch_size": 8,
"learning_rate":0.001,
"early_stopping_epochs":10,
"reduce_learning_rate_patience":3,
"source_code":"https://github.com/kaplansinan/OCTRetImageGen_CLcVAE",
}
production_details ={
"Model size": "26MB",
"Model Input": "(N,180,180,3)",
"Modeul Output":"(N,4)",
"Framework":"ONNXRuntime",
}
hardware_details ={
"Os System": "Ubuntu 20.14",
"GPU Card": "NVIDIA GeForce 3060 6GB",
}
row2_1, row2_2, row2_3= st.tabs(["General Info", "Development Info", "Production Info"])
with row2_1:
# st.write("**Architectural Details**")
st.subheader('Architectural Details')
list_test = """<ul>
<li><strong>Model Type: </strong>Convolutional Neural Nets</li>
<li> <strong>Model Description: </strong>An architecture from [EfficientNet](https://arxiv.org/abs/1905.11946) family is used for designing the model.</li>
</ul>"""
st.markdown(list_test, unsafe_allow_html=True)
# st.json(model_details)
st.caption('Architeture Visualization')
st.image(f'{ROOT_FIG_DIR}/model_architecture_vis.png')
with st.expander('License: CC BY 4.0 license(Click for details)'):
st.write("""
The files associated with this dataset are licensed under a Creative Commons Attribution 4.0 International license. What does this mean?
You can share, copy and modify this dataset so long as you give appropriate credit,
provide a link to the CC BY license, and indicate if changes were made, but you may not do
so in a way that suggests the rights holder has endorsed you or your use of the dataset.
Note that further permission may be required for any content within the dataset
that is identified as belonging to a third party. More details about the licences can be found
[here](https://creativecommons.org/about/cclicenses/).
""")
# with st.expander('Click for More Info'):
with row2_2:
st.subheader('Model Development Details')
# with st.expander('Click for More Info'):
# st.write(['Framework Details:', 'Tensorflow is used for training and testing'])
# st.caption('Framework Details:')
# st.subheader('Subheader Framework Details:')
# st.text('Fixed width text')
# st.markdown('_Markdown_') # see *
st.write(
"""
##
Training pipeline is implemented in Python. Tensorflow framework is used for training.
""")
new_title = '<h5 style="color:Black;">Training Hardware Info:</h5>'
st.markdown(new_title, unsafe_allow_html=True)
st.json(hardware_details)
new_title = '<h5 style="color:Black;">Training Hyperparameters:</h5>'
# list_test = """<ul>
# <li><strong>Model Framework: </strong>First item</li>
# <li> <strong style="color:Green;"><em>really important: </em></strong>Second item</li>
# <li><strong>Model Framework: </strong>First item</li>
# <li>Fourth item</li>
# </ul>"""
# st.markdown(list_test, unsafe_allow_html=True)
st.markdown(new_title, unsafe_allow_html=True)
# st.write("Tensorflow is used for training and testing")
# st.metric(label="Temp", value="273 K", delta="1.2 K")
# st.write("**Develooment Details**")
st.json(dev_details)
with row2_3:
# st.write("**Production Details**")
st.subheader('How to use the model')
st.write("The model is served through gRpc client and one can call the model in the production environment by following a sample code snippet written in python:")
with st.expander("Inference Call"):
code_txt = '''
import json,base64
import requests
# convert image file to base64str
def img_to_base64(filename):
with open(filename, "rb") as image_file:
base64str = base64.b64encode(image_file.read()).decode("utf-8")
return base64str
# run prediction
def predict(image_file:str,url:str):
base64_img = img_to_base64(image_file)
payload = json.dumps({"base64str": base64_img})
result = requests.post(url,data = payload)
return result.json()
# Image file
image_path = "your_image_file_with_path.png"
# Server url (an example -> "http://127.0.0.1:8080/predict")
serving_server_url = '<model_server_url>/predict'
# Inference call to serving server
preds = predict(image_path,url=serving_server_url) '''
st.code(code_txt, language='python')
st.subheader('Served Model details')
col1, col2, col3, col4,col5,col6 = st.columns(6)
col1.metric("Model Size", "26MB")
col2.metric("Model Input Size", "180x180x3")
col3.metric("Model Output", "1x4")
col6.metric("Model Framework", "ONNX")
col5.metric("GPU Inference(fps)", "45 fps")
col4.metric("CPU Inference(fps)", "20 fps")
# list_test = """<ul>
# <li><strong>Model Size: </strong>26MB</li>
# <li> <strong>Model Input: </strong>(180x180x3)</li>
# <li> <strong>Model Output: </strong>(1x4)</li>
# <li> <strong>Model Framework: </strong> ONNXRuntime</li>
# </ul>"""
# st.markdown(list_test, unsafe_allow_html=True)
def get_product_manager_page_layout():
model_details ={
"Model Description": "[EfficientNet](https://arxiv.org/abs/1905.11946) is used for transfer learning.",
"Model Type": "Convolutional Neural Nets",
}
dev_details = {
"Training Framework": "Tensorflow Keras",
"Backbone Architeture":"EfficientNetB4",
"Number of classes":4,
"Number of training epochs": 10,
"Dropout rate": 0.2,
"batch_size": 8,
"learning_rate":0.001,
"early_stopping_epochs":10,
"reduce_learning_rate_patience":3,
"source_code":"https://github.com/kaplansinan/MLOps",
}
production_details ={
"Model size": "26MB",
"Model Input": "(N,180,180,3)",
"Modeul Output":"(N,4)",
"Framework":"ONNXRuntime",
}
hardware_details ={
"Os System": "Ubuntu 20.14",
"GPU Card": "NVIDIA GeForce 3060 6GB",
}
row2_1, row2_3= st.tabs(["General Info", "Production Info"])
with row2_1:
# st.write("**Architectural Details**")
st.subheader('Architectural Details')
list_test = """<ul>
<li><strong>Model Type: </strong>Convolutional Neural Nets</li>
<li> <strong>Model Description: </strong>An architecture from [EfficientNet](https://arxiv.org/abs/1905.11946) family is used for designing the model.</li>
</ul>"""
st.markdown(list_test, unsafe_allow_html=True)
# st.json(model_details)
st.caption('Architeture Visualization')
st.image(f'{ROOT_FIG_DIR}/model_architecture_vis.png')
with st.expander('License: CC BY 4.0 license(Click for details)'):
st.write("""
The files associated with this dataset are licensed under a Creative Commons Attribution 4.0 International license. What does this mean?
You can share, copy and modify this dataset so long as you give appropriate credit,
provide a link to the CC BY license, and indicate if changes were made, but you may not do
so in a way that suggests the rights holder has endorsed you or your use of the dataset.
Note that further permission may be required for any content within the dataset
that is identified as belonging to a third party. More details about the licences can be found
[here](https://creativecommons.org/about/cclicenses/).
""")
# with st.expander('Click for More Info'):
with row2_3:
# st.write("**Production Details**")
st.subheader('How to use the model')
st.write("The model is served through gRpc client and one can call the model in the production environment by following a sample code snippet written in python:")
with st.expander("Inference Call"):
code_txt = '''
import json,base64
import requests
# convert image file to base64str
def img_to_base64(filename):
with open(filename, "rb") as image_file:
base64str = base64.b64encode(image_file.read()).decode("utf-8")
return base64str
# run prediction
def predict(image_file:str,url:str):
base64_img = img_to_base64(image_file)
payload = json.dumps({"base64str": base64_img})
result = requests.post(url,data = payload)
return result.json()
# Image file
image_path = "your_image_file_with_path.png"
# Server url (an example -> "http://127.0.0.1:8080/predict")
serving_server_url = '<model_server_url>/predict'
# Inference call to serving server
preds = predict(image_path,url=serving_server_url) '''
st.code(code_txt, language='python')
st.subheader('Served Model details')
col1, col2, col3, col4,col5,col6 = st.columns(6)
col1.metric("Model Size", "26MB")
col2.metric("Model Input Size", "180x180x3")
col3.metric("Model Output", "1x4")
col6.metric("Model Framework", "ONNX")
col5.metric("GPU Inference(fps)", "45 fps")
col4.metric("CPU Inference(fps)", "20 fps")
def get_product_practitioner_page_layout():
model_details ={
"Model Description": "[EfficientNet](https://arxiv.org/abs/1905.11946) is used for transfer learning.",
"Model Type": "Convolutional Neural Nets",
}
dev_details = {
"Training Framework": "Tensorflow Keras",
"Backbone Architeture":"EfficientNetB4",
"Number of classes":4,
"Number of training epochs": 10,
"Dropout rate": 0.2,
"batch_size": 8,
"learning_rate":0.001,
"early_stopping_epochs":10,
"reduce_learning_rate_patience":3,
"source_code":"https://github.com/kaplansinan/MLOps",
}
production_details ={
"Model size": "26MB",
"Model Input": "(N,180,180,3)",
"Modeul Output":"(N,4)",
"Framework":"ONNXRuntime",
}
hardware_details ={
"Os System": "Ubuntu 20.14",
"GPU Card": "NVIDIA GeForce 3060 6GB",
}
row2_1, row2_3= st.tabs(["General Info", "Production Info"])
with row2_1:
# st.write("**Architectural Details**")
st.subheader('Architectural Details')
list_test = """<ul>
<li><strong>Model Type: </strong>Convolutional Neural Nets</li>
<li> <strong>Model Description: </strong>An architecture from [EfficientNet](https://arxiv.org/abs/1905.11946) family is used for designing the model.</li>
</ul>"""
st.markdown(list_test, unsafe_allow_html=True)
# st.json(model_details)
st.caption('Architeture Visualization')
st.image(f'{ROOT_FIG_DIR}/model_architecture_vis.png')
with st.expander('License: CC BY 4.0 license(Click for details)'):
st.write("""
The files associated with this dataset are licensed under a Creative Commons Attribution 4.0 International license. What does this mean?
You can share, copy and modify this dataset so long as you give appropriate credit,
provide a link to the CC BY license, and indicate if changes were made, but you may not do
so in a way that suggests the rights holder has endorsed you or your use of the dataset.
Note that further permission may be required for any content within the dataset
that is identified as belonging to a third party. More details about the licences can be found
[here](https://creativecommons.org/about/cclicenses/).
""")
# with st.expander('Click for More Info'):
with row2_3:
# st.write("**Production Details**")
st.subheader('How to use the model')
st.write("The model is served through gRpc client and one can call the model in the production environment by following a sample code snippet written in python:")
with st.expander("Inference Call"):
code_txt = '''
import json,base64
import requests
# convert image file to base64str
def img_to_base64(filename):
with open(filename, "rb") as image_file:
base64str = base64.b64encode(image_file.read()).decode("utf-8")
return base64str
# run prediction
def predict(image_file:str,url:str):
base64_img = img_to_base64(image_file)
payload = json.dumps({"base64str": base64_img})
result = requests.post(url,data = payload)
return result.json()
# Image file
image_path = "your_image_file_with_path.png"
# Server url (an example -> "http://127.0.0.1:8080/predict")
serving_server_url = '<model_server_url>/predict'
# Inference call to serving server
preds = predict(image_path,url=serving_server_url) '''
st.code(code_txt, language='python')
st.subheader('Served Model details')
col1, col2, col3, col4,col5,col6 = st.columns(6)
col1.metric("Model Size", "26MB")
col2.metric("Model Input Size", "180x180x3")
col3.metric("Model Output", "1x4")
col6.metric("Model Framework", "ONNX")
col5.metric("GPU Inference(fps)", "45 fps")
col4.metric("CPU Inference(fps)", "20 fps")
# list_test = """<ul>
# <li><strong>Model Size: </strong>26MB</li>
# <li> <strong>Model Input: </strong>(180x180x3)</li>
# <li> <strong>Model Output: </strong>(1x4)</li>
# <li> <strong>Model Framework: </strong> ONNXRuntime</li>
# </ul>"""
# st.markdown(list_test, unsafe_allow_html=True) |