深度学习模型部署与应用拓展
1. 模型部署准备
在进行模型部署前,需要对相关代码进行更新。首先,在 home.html 中更新 getOption() JavaScript 函数,以构建包含模型评分参数的目标 URL。以下是定义有轨电车延迟预测部署目标 URL 的代码片段:
window.output = \
prefix.concat("route=",route_string,"&direction=",\
direction_string,"&year=",year_string,"&month=",\
month_string,"&daym=",daym_string,"&day=",\
day_string,"&hour=",hour_string)
其次,在 flask_server.py 中更新 show_prediction.html 的视图函数,为每个预测结果构建要显示的字符串:
if pred[0][0] >= 0.5:
predict_string = "yes, delay predicted"
else:
predict_string = "no delay predicted"
完成这些更改后,就可以使用之前的 Web 部署来简单部署新模型。
超级会员免费看
订阅专栏 解锁全文
6095

被折叠的 条评论
为什么被折叠?



