Skip to content

Commit b1316fb

Browse files
committed
fix: add toggle to create tensorrt service
When creating a new service from PredictHome, it's possible to set its mllib as tensorrt.
1 parent 2a4c62c commit b1316fb

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

src/components/widgets/modals/PredictAddServiceModal.js

+28-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ class PredictAddServiceModal extends React.Component {
1515
serviceName: "",
1616
gpuId: 0,
1717
addErrors: [],
18-
mediaType: null
18+
mediaType: null,
19+
isTensorRt: false
1920
};
2021

2122
this.validateBeforeSubmit = this.validateBeforeSubmit.bind(this);
@@ -25,6 +26,8 @@ class PredictAddServiceModal extends React.Component {
2526
this.handleServiceNameChange = this.handleServiceNameChange.bind(this);
2627
this.handleGpuIdChange = this.handleGpuIdChange.bind(this);
2728
this.handleMediaChange = this.handleMediaChange.bind(this);
29+
30+
this.handleTensorRtToggle = this.handleTensorRtToggle.bind(this);
2831
}
2932

3033
componentWillReceiveProps(nextProps) {
@@ -55,6 +58,10 @@ class PredictAddServiceModal extends React.Component {
5558
this.props.modalStore.setVisible("addService", false);
5659
}
5760

61+
handleTensorRtToggle(event) {
62+
this.setState({ isTensorRt: !event.target.value })
63+
}
64+
5865
validateBeforeSubmit() {
5966
const { repository } = this.props;
6067
const { serviceName } = this.state;
@@ -99,6 +106,10 @@ class PredictAddServiceModal extends React.Component {
99106

100107
let serviceData = repository.jsonConfig;
101108

109+
if(this.state.isTensorRt) {
110+
serviceData.mllib = "tensorrt";
111+
}
112+
102113
if (serviceData.parameters.output) {
103114
serviceData.parameters.output.store_config = false;
104115
} else {
@@ -199,6 +210,22 @@ class PredictAddServiceModal extends React.Component {
199210
name of the Predict service, it must be unique.
200211
</small>
201212
</div>
213+
214+
<div className="form-group">
215+
<input
216+
type="checkbox"
217+
defaultChecked={this.state.isTensorRt}
218+
onChange={this.handleToggleTensorRt}
219+
/>{" "}
220+
TensorRt Service
221+
<small
222+
id="tensorRtServiceHelp"
223+
className="form-text text-muted"
224+
>
225+
If checked, service will be created with TensorRt mllib
226+
</small>
227+
</div>
228+
202229
{gpuStoreServer && gpuStoreServer.gpuInfo ? (
203230
<div className="form-group">
204231
<label>GPU Id</label>

0 commit comments

Comments
 (0)