Spaces:
Sleeping
Sleeping
Update index.html
Browse files- index.html +3 -8
index.html
CHANGED
@@ -75,20 +75,15 @@
|
|
75 |
});
|
76 |
});
|
77 |
|
78 |
-
|
79 |
|
80 |
-
// Log the extracted text for debugging, see whether to keep or not
|
81 |
-
console.log("Analyzing text:", text);
|
82 |
|
83 |
// Extract nutritional values (assuming sugar content is labeled as '당류' in Korean)
|
84 |
-
const regex = /당류\s
|
85 |
-
// /당류\s*:\s*(\d+(\.\d+)?)\s*g\s*/; // This regex might need adjustments based on label format
|
86 |
const match = text.match(regex);
|
87 |
|
88 |
-
// Log the match result for debugging, see whether to keep
|
89 |
-
console.log("Match result:", match);
|
90 |
|
91 |
-
|
92 |
|
93 |
if (match) {
|
94 |
const sugarContent = parseFloat(match[1]);
|
|
|
75 |
});
|
76 |
});
|
77 |
|
78 |
+
function analyzeNutrition(text) {
|
79 |
|
|
|
|
|
80 |
|
81 |
// Extract nutritional values (assuming sugar content is labeled as '당류' in Korean)
|
82 |
+
const regex = /당류\s*:\s*(\d+(\.\d+)?)\s*g\s*/; // This regex might need adjustments based on label format
|
|
|
83 |
const match = text.match(regex);
|
84 |
|
|
|
|
|
85 |
|
86 |
+
let outputDiv = document.getElementById('output');
|
87 |
|
88 |
if (match) {
|
89 |
const sugarContent = parseFloat(match[1]);
|