Spaces:
Sleeping
Sleeping
Commit ·
e9d975e
1
Parent(s): 8208b10
modified all
Browse files- app.py +3 -3
- flag.tflite +3 -0
- templates/index.html +4 -4
app.py
CHANGED
|
@@ -13,7 +13,7 @@ app = Flask(__name__)
|
|
| 13 |
trained_model = YOLO("best.pt")
|
| 14 |
|
| 15 |
# Load TFLite models
|
| 16 |
-
sp_interpreter = tf.lite.Interpreter(model_path='
|
| 17 |
sp_interpreter.allocate_tensors()
|
| 18 |
|
| 19 |
c_interpreter = tf.lite.Interpreter(model_path='model_chip_v4.tflite')
|
|
@@ -88,8 +88,8 @@ def predict():
|
|
| 88 |
confidence_score_c = float(output_data_c[0][0])
|
| 89 |
# print("Confidence Score C:", confidence_score_c)
|
| 90 |
|
| 91 |
-
elif class_id ==
|
| 92 |
-
cropped_img = cv2.resize(cropped_img, (
|
| 93 |
cropped_img = cropped_img.astype('float32') / 255.0
|
| 94 |
cropped_img -= imagenet_mean
|
| 95 |
cropped_img /= imagenet_std
|
|
|
|
| 13 |
trained_model = YOLO("best.pt")
|
| 14 |
|
| 15 |
# Load TFLite models
|
| 16 |
+
sp_interpreter = tf.lite.Interpreter(model_path='flag.tflite')
|
| 17 |
sp_interpreter.allocate_tensors()
|
| 18 |
|
| 19 |
c_interpreter = tf.lite.Interpreter(model_path='model_chip_v4.tflite')
|
|
|
|
| 88 |
confidence_score_c = float(output_data_c[0][0])
|
| 89 |
# print("Confidence Score C:", confidence_score_c)
|
| 90 |
|
| 91 |
+
elif class_id == 1:
|
| 92 |
+
cropped_img = cv2.resize(cropped_img, (92, 92))
|
| 93 |
cropped_img = cropped_img.astype('float32') / 255.0
|
| 94 |
cropped_img -= imagenet_mean
|
| 95 |
cropped_img /= imagenet_std
|
flag.tflite
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a998b77d5f0158cc0c07f13582bd8b7cdf33c28490f4f77ef38129d3bed92b95
|
| 3 |
+
size 3416328
|
templates/index.html
CHANGED
|
@@ -340,7 +340,7 @@
|
|
| 340 |
confidenceScore.textContent =
|
| 341 |
"Confidence Score Chip: " +
|
| 342 |
data.confidence_score_c +
|
| 343 |
-
"Confidence Score
|
| 344 |
data.confidence_score_sp;
|
| 345 |
uploadSuccess.style.display = "block"; // Show success message
|
| 346 |
} else if (data.confidence_score_c !== undefined) {
|
|
@@ -351,7 +351,7 @@
|
|
| 351 |
} else if (data.confidence_score_sp !== undefined) {
|
| 352 |
resultsImg.src = canvas.toDataURL("image/png"); // Display captured image
|
| 353 |
confidenceScore.textContent =
|
| 354 |
-
"Confidence Score
|
| 355 |
uploadSuccess.style.display = "block"; // Show success message
|
| 356 |
} else {
|
| 357 |
alert(data.error);
|
|
@@ -400,7 +400,7 @@
|
|
| 400 |
confidenceScore.textContent =
|
| 401 |
"Confidence Score Chip: " +
|
| 402 |
data.confidence_score_c +
|
| 403 |
-
"\nConfidence Score
|
| 404 |
data.confidence_score_sp;
|
| 405 |
uploadSuccess.style.display = "block"; // Show success message
|
| 406 |
};
|
|
@@ -416,7 +416,7 @@
|
|
| 416 |
reader.readAsDataURL(file);
|
| 417 |
} else if (data.confidence_score_sp !== undefined) {
|
| 418 |
confidenceScore.textContent =
|
| 419 |
-
"Confidence Score
|
| 420 |
} else {
|
| 421 |
console.error("Error: Confidence score is undefined.");
|
| 422 |
alert(data.error || "An unexpected error occurred.");
|
|
|
|
| 340 |
confidenceScore.textContent =
|
| 341 |
"Confidence Score Chip: " +
|
| 342 |
data.confidence_score_c +
|
| 343 |
+
"Confidence Score Flag: " +
|
| 344 |
data.confidence_score_sp;
|
| 345 |
uploadSuccess.style.display = "block"; // Show success message
|
| 346 |
} else if (data.confidence_score_c !== undefined) {
|
|
|
|
| 351 |
} else if (data.confidence_score_sp !== undefined) {
|
| 352 |
resultsImg.src = canvas.toDataURL("image/png"); // Display captured image
|
| 353 |
confidenceScore.textContent =
|
| 354 |
+
"Confidence Score Flag: " + data.confidence_score_sp;
|
| 355 |
uploadSuccess.style.display = "block"; // Show success message
|
| 356 |
} else {
|
| 357 |
alert(data.error);
|
|
|
|
| 400 |
confidenceScore.textContent =
|
| 401 |
"Confidence Score Chip: " +
|
| 402 |
data.confidence_score_c +
|
| 403 |
+
"\nConfidence Score Flag : " +
|
| 404 |
data.confidence_score_sp;
|
| 405 |
uploadSuccess.style.display = "block"; // Show success message
|
| 406 |
};
|
|
|
|
| 416 |
reader.readAsDataURL(file);
|
| 417 |
} else if (data.confidence_score_sp !== undefined) {
|
| 418 |
confidenceScore.textContent =
|
| 419 |
+
"Confidence Score Flag: " + data.confidence_score_sp;
|
| 420 |
} else {
|
| 421 |
console.error("Error: Confidence score is undefined.");
|
| 422 |
alert(data.error || "An unexpected error occurred.");
|