File tree Expand file tree Collapse file tree 3 files changed +27
-0
lines changed
Expand file tree Collapse file tree 3 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -136,6 +136,15 @@ canvas{
136136 word-break : break-all;
137137 margin-right : 12px ;
138138}
139+ # load-checkpoint-btn {
140+ margin-left : 12px ;
141+ padding : 5px 10px ;
142+ font-size : 16px ;
143+ }
144+ # load-checkpoint-btn-backend {
145+ display : none;
146+ }
147+
139148# observations {
140149 font-family : monospace;
141150 font-size : 80% ;
Original file line number Diff line number Diff line change 6868 < div class ="policy-container-item ">
6969 < span id ="checkpoint-name "> default</ span >
7070 < button id ="default-checkpoint-btn "> Default</ button >
71+ < input type ="file " id ="load-checkpoint-btn-backend "> </ input >
72+ < button id ="load-checkpoint-btn "> Load File</ button >
7173 </ div >
7274 < span class ="policy-container-item "> Observations:</ span >
7375 < div class ="policy-container-item ">
Original file line number Diff line number Diff line change @@ -151,6 +151,22 @@ async function main(){
151151 document . getElementById ( "default-checkpoint-btn" ) . addEventListener ( "click" , async ( ) => {
152152 load_model ( file_url )
153153 } )
154+ document . getElementById ( "load-checkpoint-btn" ) . addEventListener ( "click" , async ( ) => {
155+ document . getElementById ( "load-checkpoint-btn-backend" ) . click ( ) ;
156+ } )
157+ document . getElementById ( "load-checkpoint-btn-backend" ) . addEventListener ( "change" , async ( ) => {
158+ const file = event . target . files [ 0 ] ;
159+ if ( file ) {
160+ const reader = new FileReader ( ) ;
161+ reader . onload = async function ( e ) {
162+ const array_buffer = e . target . result ;
163+ load_model ( array_buffer )
164+ console . log ( "loaded model: " , model . checkpoint_name )
165+ showStatus ( `Loaded model: ${ model . checkpoint_name } ` ) ;
166+ } ;
167+ reader . readAsArrayBuffer ( file ) ;
168+ }
169+ } )
154170 document . getElementById ( "observations" ) . addEventListener ( "keydown" , ( e ) => {
155171 if ( e . key === "Enter" ) {
156172 e . preventDefault ( ) ;
You can’t perform that action at this time.
0 commit comments