Spaces:
Sleeping
Sleeping
Update templates/index.html
Browse files- templates/index.html +5 -3
templates/index.html
CHANGED
@@ -83,7 +83,7 @@
|
|
83 |
<h1>성분분석표</h1>
|
84 |
<video id="video" autoplay></video>
|
85 |
<button id="snap">사진 찍기</button>
|
86 |
-
<canvas id="canvas"
|
87 |
<p id="analysisResult" class="result"></p>
|
88 |
</div>
|
89 |
|
@@ -93,7 +93,7 @@
|
|
93 |
const snap = document.getElementById('snap');
|
94 |
const context = canvas.getContext('2d');
|
95 |
const analysisResult = document.getElementById('analysisResult');
|
96 |
-
|
97 |
navigator.mediaDevices.getUserMedia({ video: true })
|
98 |
.then(stream => {
|
99 |
video.srcObject = stream;
|
@@ -108,6 +108,7 @@
|
|
108 |
const sugarContent = parseInt(match[0], 10);
|
109 |
let message = '';
|
110 |
let className = '';
|
|
|
111 |
if (sugarContent >= 0 && sugarContent <= 20) {
|
112 |
message = 'good';
|
113 |
className = 'good';
|
@@ -118,7 +119,8 @@
|
|
118 |
message = 'dangerous';
|
119 |
className = 'dangerous';
|
120 |
}
|
121 |
-
|
|
|
122 |
analysisResult.className = className;
|
123 |
} else {
|
124 |
analysisResult.textContent = 'Error: Could not analyze image.';
|
|
|
83 |
<h1>성분분석표</h1>
|
84 |
<video id="video" autoplay></video>
|
85 |
<button id="snap">사진 찍기</button>
|
86 |
+
<canvas id="canvas"></canvas>
|
87 |
<p id="analysisResult" class="result"></p>
|
88 |
</div>
|
89 |
|
|
|
93 |
const snap = document.getElementById('snap');
|
94 |
const context = canvas.getContext('2d');
|
95 |
const analysisResult = document.getElementById('analysisResult');
|
96 |
+
|
97 |
navigator.mediaDevices.getUserMedia({ video: true })
|
98 |
.then(stream => {
|
99 |
video.srcObject = stream;
|
|
|
108 |
const sugarContent = parseInt(match[0], 10);
|
109 |
let message = '';
|
110 |
let className = '';
|
111 |
+
|
112 |
if (sugarContent >= 0 && sugarContent <= 20) {
|
113 |
message = 'good';
|
114 |
className = 'good';
|
|
|
119 |
message = 'dangerous';
|
120 |
className = 'dangerous';
|
121 |
}
|
122 |
+
|
123 |
+
analysisResult.textContent = message;
|
124 |
analysisResult.className = className;
|
125 |
} else {
|
126 |
analysisResult.textContent = 'Error: Could not analyze image.';
|