@@ -15,7 +15,8 @@ class PredictAddServiceModal extends React.Component {
15
15
serviceName : "" ,
16
16
gpuId : 0 ,
17
17
addErrors : [ ] ,
18
- mediaType : null
18
+ mediaType : null ,
19
+ isTensorRt : false
19
20
} ;
20
21
21
22
this . validateBeforeSubmit = this . validateBeforeSubmit . bind ( this ) ;
@@ -25,6 +26,8 @@ class PredictAddServiceModal extends React.Component {
25
26
this . handleServiceNameChange = this . handleServiceNameChange . bind ( this ) ;
26
27
this . handleGpuIdChange = this . handleGpuIdChange . bind ( this ) ;
27
28
this . handleMediaChange = this . handleMediaChange . bind ( this ) ;
29
+
30
+ this . handleTensorRtToggle = this . handleTensorRtToggle . bind ( this ) ;
28
31
}
29
32
30
33
componentWillReceiveProps ( nextProps ) {
@@ -55,6 +58,10 @@ class PredictAddServiceModal extends React.Component {
55
58
this . props . modalStore . setVisible ( "addService" , false ) ;
56
59
}
57
60
61
+ handleTensorRtToggle ( event ) {
62
+ this . setState ( { isTensorRt : ! event . target . value } )
63
+ }
64
+
58
65
validateBeforeSubmit ( ) {
59
66
const { repository } = this . props ;
60
67
const { serviceName } = this . state ;
@@ -99,6 +106,10 @@ class PredictAddServiceModal extends React.Component {
99
106
100
107
let serviceData = repository . jsonConfig ;
101
108
109
+ if ( this . state . isTensorRt ) {
110
+ serviceData . mllib = "tensorrt" ;
111
+ }
112
+
102
113
if ( serviceData . parameters . output ) {
103
114
serviceData . parameters . output . store_config = false ;
104
115
} else {
@@ -199,6 +210,22 @@ class PredictAddServiceModal extends React.Component {
199
210
name of the Predict service, it must be unique.
200
211
</ small >
201
212
</ 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
+
202
229
{ gpuStoreServer && gpuStoreServer . gpuInfo ? (
203
230
< div className = "form-group" >
204
231
< label > GPU Id</ label >
0 commit comments