| 651 | } |
| 652 | |
| 653 | render(_, {err}) { |
| 654 | if (this.state.model === null) { |
| 655 | return html`<h1>Loading...</h1>`; |
| 656 | } |
| 657 | |
| 658 | const model = this.state.model.model; |
| 659 | |
| 660 | let error_msg = ""; |
| 661 | if (err) { |
| 662 | error_msg = html`<h2 style="background:red">An error occurred. Check console</h2>`; |
| 663 | } |
| 664 | |
| 665 | return html` |
| 666 | ${error_msg} |
| 667 | <div id=main_content style="position:absolute;width:99%;height:79%;overflow:scroll"> |
| 668 | <h1>TorchScript Model (version ${model.version}): ${model.title}</h1> |
| 669 | <button onClick=${() => console.log(model)}>Log Raw Model Info</button> |
| 670 | <${ModelSizeSection} model=${model}/> |
| 671 | <${StructuredDataSection} name="Model Data" data=${model.model_data} shown=true/> |
| 672 | <${StructuredDataSection} name="Constants" data=${model.constants} shown=false/> |
| 673 | <${ZipContentsSection} model=${model}/> |
| 674 | <${CodeSection} model=${model}/> |
| 675 | <${ExtraJsonSection} files=${model.extra_files_jsons}/> |
| 676 | <${ExtraPicklesSection} files=${model.extra_pickles}/> |
| 677 | <${TensorMemorySection} model=${model}/> |
| 678 | </div> |
| 679 | <div id=aux_content style="position:absolute;width:99%;top:80%;height:20%;overflow:scroll"> |
| 680 | <${AuxContentPane} |
| 681 | err=${this.state.error} |
| 682 | model=${model} |
| 683 | ref=${(p) => blame.setAuxContentPane(p)}/> |
| 684 | </div> |
| 685 | `; |
| 686 | } |
| 687 | } |
| 688 | |
| 689 | render(h(App), document.body); |