update code

main
haha 2024-07-26 22:56:44 +08:00
parent 1b6dca100a
commit 3da7053984
11 changed files with 2122 additions and 1035 deletions

View File

@ -54,6 +54,7 @@
"color": "^4.2.3",
"echarts": "^5.5.0",
"element-plus": "^2.7.2",
"js-md5": "^0.8.3",
"lodash-es": "^4.17.21",
"net": "^1.0.2",
"nprogress": "^0.2.0",

View File

@ -1 +1,57 @@
function init(){var s=location.search;var url="";var onnxModelName="";if(s.indexOf("=")>=0){url=s.substring(s.indexOf("=")+1);if(url.toLocaleLowerCase().indexOf(".onnx")>=0){onnxModelName=url.substring(url.lastIndexOf("/")+1)}else{console.error("使用方法:onnx.html?url=[onnx路径]");return}}else{console.error("使用方法:onnx.html?url=[onnx路径]");return}document.body.title=onnxModelName;var http=new XMLHttpRequest;http.responseType="arraybuffer";http.open("GET",url);http.onload=function(){if(http.status==200){var reader=proto.protobuf.Reader.create(new Uint8Array(http.response));var onnxProtoModel=window.proto.onnx.ModelProto.decode(reader);let{locations,graphs}=window.getExternalLocations(onnxProtoModel);let model=new window.onnx.Model(onnxProtoModel,graphs,new Map);let host=window;let view=new window.View(host);view.start().then(data=>{view.open(model,onnxModelName)}).catch(err=>{console.log(err)});window.mainView=view}};http.send()}function exportImg(file,blob){const element=this.document.createElement("a");element.download=file;element.href=URL.createObjectURL(blob);this.document.body.appendChild(element);element.click();this.document.body.removeChild(element)}function toggleMenu(){let el=document.getElementById("menu");if(el.style.display=="none"){el.style.display="block";updateState()}else{el.style.display="none"}}function doToggle(att){mainView.toggle(att);updateState()}function updateState(){var op=mainView.options;document.getElementById("opAtt").innerText=op.attributes?"Hide Attributes":"Show Attributes";document.getElementById("opWeight").innerText=op.weights?"Hide Weights":"Show Weights";document.getElementById("opName").innerText=op.names?"Hide Names":"Show Names";document.getElementById("opDir").innerText=op.direction=="vertical"?"Show Horizontal":"Show Vertical";document.getElementById("opMouse").innerText=op.mousewheel=="scroll"?"Mouse Wheel: Zoom":"Mouse Wheel: Scroll"}init();
function init() {
var s = location.search;
var url = "";
var onnxModelName = "";
if (s.indexOf("=") >= 0) {
url = s.substring(s.indexOf("=") + 1);
} else {
console.error("使用方法:onnx.html?id=[模型ID]")
return;
}
document.body.title = onnxModelName;
var accessToken = localStorage.getItem("accessToken");
var http = new XMLHttpRequest();
http.responseType = "json"
http.open('GET', MODELDOWNLOADAPI + `${url}/download`);
http.setRequestHeader("Authorization", accessToken);
http.onload = function () {
if (http.status == 200) {
var reader = proto.protobuf.Reader.create(base64ToUint8Array(http.response.data.file_content));
var onnxProtoModel = window.proto.onnx.ModelProto.decode(reader);
let { locations, graphs } = window.getExternalLocations(onnxProtoModel);
let model = new window.onnx.Model(onnxProtoModel, graphs, new Map());
let host = window;
let view = new window.View(host);
view.start().then((data) => {
view.open(model, onnxModelName);
}).catch((err) => {
console.log(err);
})
window.mainView = view;
}
};
http.send();
}
function base64ToUint8Array(base64String) {
try {
let padding = '='.repeat((4 - base64String.length % 4) % 4);
let base64 = (base64String + padding)
.replace(/\-/g, '+')
.replace(/_/g, '/');
let rawData = atob(base64);
let outputArray = new Uint8Array(rawData.length);
for (let i = 0; i < rawData.length; ++i) {
outputArray[i] = rawData.charCodeAt(i);
}
return outputArray;
}
catch (e) {
throw e;
}
}
init();

File diff suppressed because it is too large Load Diff

View File

@ -7,10 +7,11 @@ const tasks=()=>{
})
}
//获取可用的设备状态
const availableDevices=()=>{
const availableDevices = (data) => {
return request({
url: '/tasks/available_devices',
method:'get'
method: 'get',
params: data
})
}
//获取正在执行的任务

View File

@ -81,12 +81,11 @@
<span class="sp-label">输入参数:</span>
<div class="div-param">
<div v-if="info.param.inputs.length > 1" class="div-navs">
<span v-for="(it, idx) in info.param.inputs" @click="doInputSelected(idx)" :key="idx"
class="sp-nav" :class="it.selected ? 'active' : ''">{{ it.input_id }}</span>
<span v-for="(it, idx) in info.param.inputs" @click="doInputSelected(idx)" :key="idx" class="sp-nav"
:class="it.selected ? 'active' : ''">{{ it.input_id }}</span>
</div>
<span class="sp-text sp-paramter scroll">
<span v-for="(it, idx) in info.param.inputs " :key="idx" v-show="it.selected"
class="param-item">
<span v-for="(it, idx) in info.param.inputs " :key="idx" v-show="it.selected" class="param-item">
<paramShow :paramInfo="it"></paramShow>
</span>
</span>
@ -96,13 +95,12 @@
<span class="sp-label">输出参数:</span>
<div class="div-param">
<div v-if="info.param.outputs.length > 1" class="div-navs">
<span v-for="(it, idx) in info.param.outputs" @click="doOutputSelected(idx)"
:key="idx" class="sp-nav" :class="it.selected ? 'active' : ''">{{ it.output_id
<span v-for="(it, idx) in info.param.outputs" @click="doOutputSelected(idx)" :key="idx" class="sp-nav"
:class="it.selected ? 'active' : ''">{{ it.output_id
}}</span>
</div>
<span class="sp-text sp-paramter scroll">
<span v-for="(it, idx) in info.param.outputs " :key="idx" v-show="it.selected"
class="param-item">
<span v-for="(it, idx) in info.param.outputs " :key="idx" v-show="it.selected" class="param-item">
<paramShow :paramInfo="it"></paramShow>
</span>
</span>
@ -194,6 +192,7 @@ const doOutputSelected=idx=>{
display: inline-block;
margin-left: 4px;
}
.sp-paramter {
height: 100px;
border: solid 1px #409EFF;

View File

@ -21,7 +21,7 @@
<el-table v-loading="loading" :data="info.data" stripe @selection-change="handleSelectionChange">
<el-table-column label="模型名称" align="left" prop="model_name" />
<el-table-column label="网络名称" align="left" prop="modl_net_type" width="120" />
<el-table-column label="模型类型" align="left" prop="modl_main_type_name">
<el-table-column label="模型类型" align="left" prop="modl_net_type">
<template #default="{ row }">{{ row.modl_main_type_name }}/{{ row.modl_sub_type_name }}</template>
</el-table-column>
<el-table-column label="版本" align="left" prop="connection_version" />
@ -38,15 +38,13 @@
<el-table-column label="操作" fixed="right" align="center" width="270">
<template #default="scope">
<template v-if="scope.row.connection_created">
<el-button text type="primary" size="small"
@click="doShowDetail(scope.row)"><i-ep-edit />查看</el-button>
<el-button text type="primary" size="small" @click="doShowDetail(scope.row)"><i-ep-edit />查看</el-button>
<el-button text type="primary" size="small"
@click="doEdit(scope.row.connection_id)"><i-ep-link />修改互联</el-button>
<el-button text type="primary" size="small" @click="handleDelete(scope.row)"><i-ep-delete />删除</el-button>
</template>
<template v-else>
<el-button text type="primary" size="small"
@click="doAdd(scope.row)">新建互联</el-button>
<el-button text type="primary" size="small" @click="doAdd(scope.row)"></el-button>
</template>
</template>
</el-table-column>
@ -92,8 +90,8 @@ function handleQuery() {
loading.value = true;
ConnApi.list(queryParams).then(d => {
loading.value = false;
info.total=d.data?.total||0;
info.data=d.data?.data||[];
info.total = d.data?.data?.total || 0;
info.data = d.data?.data?.connection_list || [];
});
}
@ -156,16 +154,18 @@ onMounted(() => {
.search-container {
display: flex;
}
.card-footer {
position: fixed;
width: calc(100% - 215px);
bottom: 0px;
:deep(.el-card__body) {
padding: 0px;
.el-pagination {
justify-content: end;
}
}
}
</style>

View File

@ -100,7 +100,7 @@ defineExpose({
})
const initData = () => {
OperApi.list().then(d => {
OperApi.list({ page_num: 1, page_size: 100 }).then(d => {
let tmps = (d.data?.data?.operator_list || []).map(it => {
it.show = true;
it.text = it.operator_name;
@ -186,6 +186,7 @@ onMounted(() => {
&.item4 {
background: #A7BEE7;
}
&.item5 {
background: #4C8DD1;
}

View File

@ -35,7 +35,7 @@
<td style="width: 50%;">
<span class="sp-title">模型网络:</span>
<span class="sp-text">
{{modelInfo.info.modl_net_type}}
{{ modelInfo.info.model_net_type }}
</span>
</td>
<td style="width: 50%;">
@ -67,7 +67,9 @@
<td style="width: 50%;">
<span class="sp-title">网络配置:</span>
<span class="sp-text sp-file">
<a style="line-height:24px;"ref="#"><el-icon><Document /></el-icon></a>
<a style="line-height:24px;" ref="#"><el-icon>
<Document />
</el-icon></a>
</span>
</td>
</tr>
@ -76,7 +78,7 @@
<el-card style="margin-top: 12px;">
<template #header>
<svg-icon icon-class="pause" style="width:20px;height:20px;" />可适配算子</template>
<el-button v-for="(it,idx) in modelInfo.opers" :key="idx">{{ it.oper_type_name }}</el-button>
<el-button v-for="(it, idx) in modelInfo.opers" :key="idx">{{ it.operator_name }}</el-button>
</el-card>
<el-card style="margin-top: 12px;margin-bottom:60px;">
@ -84,7 +86,8 @@
<svg-icon icon-class="pause" style="width:20px;height:20px;" />
模型结构</template>
<div style="position: relative;min-height:50vh;" class="scroll">
<iframe frameborder="0" scrolling="no" :src="url" style="width:100%;height:100%;position: absolute;top:0px;"></iframe>
<iframe frameborder="0" scrolling="no" :src="url"
style="width:100%;height:100%;position: absolute;top:0px;"></iframe>
</div>
</el-card>
<el-card class="card-footer">
@ -114,7 +117,8 @@ const initData=()=>{
});
};
onMounted(() => {
url.value="./onnx/onnx.html?url=/ai/siamRPN_192.onnx";
let id = route.query.id;
url.value = "./onnx/onnx.html?id=" + id;
initData();
});
const doBack = () => {
@ -133,24 +137,31 @@ const doBack=()=>{
align-items: center
}
}
.sp-file {
color: #29d;
}
.tb-base-info {
line-height: 30px;
:deep(span) {
font-size: 14px;
}
}
:deep(.svg-icon) {
margin-right: 8px;
}
.card-footer {
position: fixed;
width: calc(100% - 215px);
bottom: 0px;
:deep(.el-card__body) {
padding: 10px;
.el-pagination {
justify-content: end;
}

View File

@ -53,13 +53,14 @@ function handleQuery(a) {
//ElMessage.success("");
loading.value = true;
connApi.list(queryParams).then(d => {
loading.value=false;
info.data=(d.data?.data||[]).map(it=>{
it.id=it.connection_id;
it.modelType=it.modl_main_type_name+"/"+it.modl_sub_type_name;
loading.value = false; debugger
info.data = (d.data?.data?.connection_list || []).map(it => {
it.id = it.model_id;
it.modelType = it.modl_net_type;
return it;
});
total.value=d.data?.total||0;
total.value = d.data?.data?.total || 0;
});
}

View File

@ -117,6 +117,7 @@ const doChoiceSuccess = item => {
function handleQuery() {
loading.value = true;
let m = props.modelInfo;
debugger
taskApi
.availableDevices({
connection_id: m.connection_id,

View File

@ -6045,6 +6045,11 @@ js-base64@^2.1.9:
resolved "https://registry.npmmirror.com/js-base64/-/js-base64-2.6.4.tgz#f4e686c5de1ea1f867dbcad3d46d969428df98c4"
integrity sha512-pZe//GGmwJndub7ZghVHz7vjb2LgC1m8B07Au3eYqeqv9emhESByMXxaEgkUkEqJe87oBbSniGYoQNIBklc7IQ==
js-md5@^0.8.3:
version "0.8.3"
resolved "https://registry.npmmirror.com/js-md5/-/js-md5-0.8.3.tgz#921bab7efa95bfc9d62b87ee08a57f8fe4305b69"
integrity sha512-qR0HB5uP6wCuRMrWPTrkMaev7MJZwJuuw4fnwAzRgP4J4/F8RwtodOKpGp4XpqsLBFzzgqIO42efFAyz2Et6KQ==
js-tokens@^4.0.0:
version "4.0.0"
resolved "https://registry.npmmirror.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499"