Explorar o código

Fix duplicate ONNX import statements

Lutz Roeder %!s(int64=8) %!d(string=hai) anos
pai
achega
5cba8d14a9
Modificáronse 2 ficheiros con 6 adicións e 10 borrados
  1. 5 2
      src/onnx-model.js
  2. 1 8
      src/view-template.js

+ 5 - 2
src/onnx-model.js

@@ -58,9 +58,12 @@ class OnnxModel {
             var opsetImports = [];
             this._model.opsetImport.forEach((opsetImport) => {
                 var domain = opsetImport.domain ? opsetImport.domain : 'ai.onnx';
-                opsetImports.push(domain + ' v' + opsetImport.version);
+                var result = domain + ' v' + opsetImport.version;
+                if (!opsetImports.includes(result)) {
+                    opsetImports.push(result);
+                }
             });
-            results.push({ name: 'Imports', value: opsetImports.join('<br>') });
+            results.push({ name: 'Imports', value: opsetImports.join(', ') });
         }
         var producer = [];
         if (this._model.producerName) {

+ 1 - 8
src/view-template.js

@@ -143,19 +143,12 @@ var summaryTemplate = `
 .summary { font-family: 'Open Sans', --apple-system, "Helvetica Neue", Helvetica, Arial, sans-serf; font-size: 12px; line-height: 1.5; overflow: hidden; margin: auto; }
 .summary h1 { font-family: inherit; font-weight: 600; font-size: 12px; margin: 0; color: #666; letter-spacing: 0.5px; padding: 10px 0px 0px 0px; margin: 20px 0px 0px 0px; -webkit-user-select: none; -moz-user-select: none; user-select: none; }
 .summary .section { color: #777; margin-top: 10px; margin-bottom: 10px; padding: 10px; overflow-y: auto; position: relative; border: 1px solid none; border-radius: 10px; border: 1px solid #ccc; }
-.summary .section .property { margin-bottom: 3px; overflow: hidden; width: 100% !important; }
+.summary .section .property { margin: 2px 0 2px 0; overflow: hidden; width: 100% !important; }
 .summary .section .property .name { float: left; clear: left; width: 80px; min-width: 80px; font-weight: 600; }
 .summary .section .property .value { overflow: hidden; }
 .summary .section .property .value b { font-weight: 600; }
 .summary .section .property .value input { font-family: inherit; font-size: inherit; color: inherit; background-color: inherit; width: 100%; margin: 0; padding: 0; border: 0; outline: none; text-overflow: ellipsis; }
 .summary .section .property .value code { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 10px; background-color: rgba(27, 31, 35, 0.05); padding: 0.2em 0.4em; margin: 0; border-radius: 3px; background-color: #d6d6d6; }
-
-.summary .border {  }
-.summary .section table b {  }
-.summary .section table { color: #777; float: left; font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 12px; border-spacing: 0; line-height: 150%; }
-.summary .section table td:first-child { font-weight: 600; width: 80px; vertical-align: top; user-select: none; -webkit-user-select: none; -moz-user-select: none; }
-.summary .section table td { user-select: text; -webkit-user-select: text; -moz-user-select: text; }
-.summary .section table tr>td { padding-bottom: 3px; }
 </style>
 
 <div class='summary'>