Skip to content

Commit

Permalink
[central] Upgrade nodejs version to 18.7.0 (#216)
Browse files Browse the repository at this point in the history
  • Loading branch information
frankfliu authored Aug 14, 2022
1 parent a6c124d commit 50c6bfa
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 4,636 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ bin/

#node
node_modules/
**/static/dist/

#vscode
.vscode
1 change: 1 addition & 0 deletions central/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/package-lock.json
12 changes: 6 additions & 6 deletions central/build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
plugins {
// Apply the java-library plugin to add support for Java Library
id 'java-library'
id "com.github.node-gradle.node" version "2.2.4"
id "com.github.node-gradle.node" version "3.4.0"
id 'application'
}

node {
version = '14.15.3'
npmVersion = '6.14.9'
version = '18.7.0'
npmVersion = '8.17.0'
download = true
}

Expand All @@ -21,7 +21,7 @@ task buildReactApp(type: NodeTask, dependsOn: 'npmInstall') {
args = [
'--mode', 'development',
'--entry', './src/main/webapp/Main.jsx',
'-o', './src/main/resources/static/dist/modelzoo-frontend.js'
'-o', './src/main/resources/static/central'
]
}

Expand All @@ -37,8 +37,8 @@ if (project.getProjectDir().toString() == System.getProperty("user.dir")) {
}

clean.delete << file('node_modules')
clean.delete << file('src/main/resources/static/dist')

clean.delete << file('src/main/resources/static/central/main.js')
clean.delete << file('src/main/resources/static/central/main.js.map')

jar {
manifest {
Expand Down
4,614 changes: 0 additions & 4,614 deletions central/package-lock.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
package ai.djl.serving.central.model.dto;

import ai.djl.repository.Artifact;
import ai.djl.translate.ArgumentsUtil;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -28,8 +29,8 @@ public class ComputerVisionModelDTO extends ModelDTO {

private static final Logger logger = LoggerFactory.getLogger(ComputerVisionModelDTO.class);

private double width;
private double height;
private float width;
private float height;
private boolean resize;
private boolean rescale;

Expand Down Expand Up @@ -57,10 +58,10 @@ public ComputerVisionModelDTO(Artifact artifact) {
Map<String, Object> arguments = artifact.getArguments(null);
if (arguments != null) {
try {
this.width = (double) arguments.getOrDefault("width", 0.0d);
this.height = (double) arguments.getOrDefault("height", 0.0d);
this.resize = (boolean) arguments.getOrDefault("resize", false);
this.rescale = (boolean) arguments.getOrDefault("rescale", false);
width = ArgumentsUtil.floatValue(arguments, "width", 0.0f);
height = ArgumentsUtil.floatValue(arguments, "height", 0.0f);
resize = ArgumentsUtil.booleanValue(arguments, "resize", false);
rescale = ArgumentsUtil.booleanValue(arguments, "rescale", false);
} catch (ClassCastException ex) {
logger.error("Argument in model is not of expected type.", ex);
}
Expand Down
2 changes: 2 additions & 0 deletions central/src/main/resources/static/central/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
main.js
main.js.map
14 changes: 14 additions & 0 deletions central/src/main/resources/static/central/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="minimum-scale=1, initial-scale=1, width=device-width"/>
<title>ModelZoo Repository</title>
<link rel="stylesheet"
href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap"/>
</head>
<body style="background: rgb(0, 0, 64);margin: 0 auto;">
<div id="react-mountpoint"></div>
<script src="main.js"></script>
</body>
</html>
19 changes: 10 additions & 9 deletions central/src/main/resources/static/index.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="minimum-scale=1, initial-scale=1, width=device-width"/>
<meta name="viewport" content="minimum-scale=1, initial-scale=1, width=device-width"/>
<title>ModelZoo Repository</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" />
</head>
<body style="background: rgb(0, 0, 64);margin: 0 auto;">
<div id="react-mountpoint"></div>
<script src="/dist/modelzoo-frontend.js/main.js"></script>
</body>
</html>
<link rel="stylesheet"
href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap"/>
</head>
<body style="background: rgb(0, 0, 64);margin: 0 auto;">
<div id="react-mountpoint"></div>
<script src="/central/main.js"></script>
</body>
</html>

0 comments on commit 50c6bfa

Please sign in to comment.