Skip to content

Commit b9b34dd

Browse files
【fix】 修改web ai例子模型地址 review by songym
1 parent 592e246 commit b9b34dd

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

examples/mapboxgl/binaryClassification.html

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,15 @@
2222
<script type="text/javascript" include="bootstrap,vue" src="../js/include-web.js"></script>
2323
<script include="iclient-mapboxgl-vue,mapbox-gl-enhance" src="../../dist/mapboxgl/include-mapboxgl.js"></script>
2424
<script>
25-
let img = document.querySelector('#tileImg16');
26-
let canvas = document.querySelector('#data-canvas1');
27-
let ctx = canvas.getContext('2d');
28-
let predictBtn = document.querySelector('#predict');
25+
var host = window.isLocal ? window.server : "https://iserver.supermap.io";
26+
var modelUrl = host + '/web/data/machine_learning/binary_classification/model.json';
27+
var img = document.querySelector('#tileImg16');
28+
var canvas = document.querySelector('#data-canvas1');
29+
var ctx = canvas.getContext('2d');
30+
var predictBtn = document.querySelector('#predict');
2931
ctx.drawImage(img, 0, 0, 640, 640);
30-
let webMachineLearning = new SuperMap.WebMachineLearning();
31-
let binaryClassification = new SuperMap.BinaryClassification({ modelUrl: 'http://192.168.11.148:8084/model.json', image: img });
32+
var webMachineLearning = new SuperMap.WebMachineLearning();
33+
var binaryClassification = new SuperMap.BinaryClassification({ modelUrl, image: img });
3234
predictBtn.addEventListener('click', function() {
3335
webMachineLearning.execute(binaryClassification).then((res) => {
3436
const { data, width, height } = res;

examples/mapboxgl/landcoverClassification.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,15 @@
2222
<script include="iclient-mapboxgl-vue,mapbox-gl-enhance" src="../../dist/mapboxgl/include-mapboxgl.js"></script>
2323

2424
<script>
25+
var host = window.isLocal ? window.server : "https://iserver.supermap.io";
26+
var modelUrl = host + '/web/data/machine_learning/landcover_classification/model.json';
2527
let img = document.querySelector('#landcover');
2628
let canvas = document.querySelector('#data-canvas1');
2729
let ctx = canvas.getContext('2d');
2830
let predictBtn = document.querySelector('#predict');
2931
ctx.drawImage(img, 0, 0, 640, 640);
3032
let webMachineLearning = new SuperMap.WebMachineLearning();
31-
let landcoverClassification = new SuperMap.LandcoverClassification({ modelUrl: 'http://192.168.11.148:6677/model.json', image: img });
33+
let landcoverClassification = new SuperMap.LandcoverClassification({ modelUrl, image: img });
3234
const colorMap = [[0,0,0], [255,0,0],[0,255,0],[0,255,255],[255,255,0],[0,0,255]];
3335
predictBtn.addEventListener('click', function() {
3436
webMachineLearning.execute(landcoverClassification).then((res) => {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy