Skip to content

Commit 6e80fa0

Browse files
author
minjk-bl
committed
Add Save/Load app for ml models
1 parent b210182 commit 6e80fa0

File tree

3 files changed

+24
-4
lines changed

3 files changed

+24
-4
lines changed

visualpython/html/m_ml/saveLoad.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
<option value="model_save">Save model</option>
55
<option value="model_load">Load model</option>
66
</select>
7-
<div class="vp-modelio-option-box vp-grid-border-box vp-grid-col-110 mt5">
8-
7+
<div class="vp-grid-border-box mt5">
8+
<div class="vp-modelio-option-box vp-grid-col-110">
9+
10+
</div>
911
</div>
1012
</div>
1113
</body>

visualpython/js/com/com_generatorV2.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,7 @@ define([
459459
div.append(input);
460460
div.append(fileBrowerButton);
461461

462+
$(document).off('click', pageThis.wrapSelector(`.vp-file-browser-button[data-parent="${obj.name}"]`));
462463
$(document).on('click', pageThis.wrapSelector(`.vp-file-browser-button[data-parent="${obj.name}"]`), function() {
463464
let fileNavi = new FileNavigation({
464465
type: 'save',
@@ -497,6 +498,7 @@ define([
497498
div.append(input);
498499
div.append(fileBrowerButton);
499500

501+
$(document).off('click', pageThis.wrapSelector(`.vp-file-browser-button[data-parent="${obj.name}"]`));
500502
$(document).on('click', pageThis.wrapSelector(`.vp-file-browser-button[data-parent="${obj.name}"]`), function() {
501503
let fileNavi = new FileNavigation({
502504
type: 'open',

visualpython/js/m_ml/SaveLoad.js

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ define([
3838
modelio: 'model_save', // model_save / model_load
3939
target: '',
4040
allocateTo: '',
41-
path: '',
41+
userOption: '',
42+
savePath: '',
43+
loadPath: '',
4244
...this.state
4345
}
4446

@@ -54,7 +56,14 @@ define([
5456
let modelio = $(this).val();
5557
that.state.modelio = modelio;
5658
$(that.wrapSelector('.vp-modelio-option-box')).html(that.templateForOption(modelio));
59+
60+
$(that.wrapSelector('#userOption')).val('');
5761
});
62+
63+
// user option
64+
$(this.wrapSelector('#userOption')).on('change', function() {
65+
that.state.userOption = $(this).val();
66+
})
5867
}
5968

6069
templateForBody() {
@@ -63,6 +72,9 @@ define([
6372
// render option page
6473
$(page).find('.vp-modelio-option-box').html(this.templateForOption(this.state.modelio));
6574

75+
$(page).find('#modelio').val(this.state.modelio);
76+
$(page).find('#userOption').val(this.state.userOption);
77+
6678
return page;
6779
}
6880

@@ -95,7 +107,11 @@ define([
95107
generateCode() {
96108
let { modelio, userOption } = this.state;
97109
let code = new com_String();
98-
let modelCode = com_generator.vp_codeGenerator(this, this.mlConfig[modelio], this.state);
110+
if (userOption && userOption != '') {
111+
userOption = ', ' + userOption;
112+
}
113+
114+
let modelCode = com_generator.vp_codeGenerator(this, this.mlConfig[modelio], this.state, userOption);
99115
code.append(modelCode);
100116
return code.toString();
101117
}

0 commit comments

Comments
 (0)