Update templates/index.html
Browse files- templates/index.html +0 -14
templates/index.html
CHANGED
|
@@ -45,14 +45,12 @@
|
|
| 45 |
</div>
|
| 46 |
<div id="prediction-box">
|
| 47 |
<p id="prediction">Prediction: <span id="prediction-text">N/A</span></p>
|
| 48 |
-
<p id="prediction2">Prediction2: <span id="prediction-text2">N/A</span></p>
|
| 49 |
</div>
|
| 50 |
<button id="switch-camera">Switch Camera</button>
|
| 51 |
|
| 52 |
<script>
|
| 53 |
const video = document.getElementById('video');
|
| 54 |
const predictionElem = document.getElementById('prediction-text');
|
| 55 |
-
const predictionElem2 = document.getElementById('prediction-text2');
|
| 56 |
const switchCameraBtn = document.getElementById('switch-camera');
|
| 57 |
let useFrontCamera = true; // Start with front-facing camera
|
| 58 |
// Condition to determine which prediction to show
|
|
@@ -94,18 +92,6 @@
|
|
| 94 |
// Convert the image to base64
|
| 95 |
const imageData = canvas.toDataURL('image/jpeg');
|
| 96 |
|
| 97 |
-
fetch('/textis', {
|
| 98 |
-
method: 'POST',
|
| 99 |
-
headers: {
|
| 100 |
-
'Content-Type': 'application/json',
|
| 101 |
-
},
|
| 102 |
-
body: JSON.stringify({ image: imageData }),
|
| 103 |
-
})
|
| 104 |
-
.then(response => response.json())
|
| 105 |
-
.then(data => {
|
| 106 |
-
predictionElem2.textContent = `bool: ${data.prediction}`; // Update vegetable prediction
|
| 107 |
-
})
|
| 108 |
-
.catch(err => console.error('Error:', err));
|
| 109 |
|
| 110 |
|
| 111 |
if (showVegetablePrediction) {
|
|
|
|
| 45 |
</div>
|
| 46 |
<div id="prediction-box">
|
| 47 |
<p id="prediction">Prediction: <span id="prediction-text">N/A</span></p>
|
|
|
|
| 48 |
</div>
|
| 49 |
<button id="switch-camera">Switch Camera</button>
|
| 50 |
|
| 51 |
<script>
|
| 52 |
const video = document.getElementById('video');
|
| 53 |
const predictionElem = document.getElementById('prediction-text');
|
|
|
|
| 54 |
const switchCameraBtn = document.getElementById('switch-camera');
|
| 55 |
let useFrontCamera = true; // Start with front-facing camera
|
| 56 |
// Condition to determine which prediction to show
|
|
|
|
| 92 |
// Convert the image to base64
|
| 93 |
const imageData = canvas.toDataURL('image/jpeg');
|
| 94 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
|
| 96 |
|
| 97 |
if (showVegetablePrediction) {
|