Skip to content

Commit 56eaa76

Browse files
committed
use family.extension
1 parent 1bc27af commit 56eaa76

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

photon-server/src/main/java/org/photonvision/server/RequestHandler.java

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -605,16 +605,13 @@ public static void onImportObjectDetectionModelRequest(Context ctx) {
605605
return;
606606
}
607607

608-
String modelFileExtension = "";
609608
NeuralNetworkModelManager.Family family;
610609

611610
switch (Platform.getCurrentPlatform()) {
612611
case LINUX_QCS6490:
613-
modelFileExtension = "tflite";
614612
family = NeuralNetworkModelManager.Family.RUBIK;
615613
break;
616614
case LINUX_RK3588_64:
617-
modelFileExtension = "rknn";
618615
family = NeuralNetworkModelManager.Family.RKNN;
619616
break;
620617
default:
@@ -625,19 +622,19 @@ public static void onImportObjectDetectionModelRequest(Context ctx) {
625622
}
626623

627624
// If adding additional platforms, check platform matches
628-
if (!modelFile.extension().contains(modelFileExtension)) {
625+
if (!modelFile.extension().contains(family.extension())) {
629626
ctx.status(400);
630627
ctx.result(
631628
"The uploaded file was not of type '"
632-
+ modelFileExtension
629+
+ family.extension()
633630
+ "'. The uploaded file should be a ."
634-
+ modelFileExtension
631+
+ family.extension()
635632
+ " file.");
636633
logger.error(
637634
"The uploaded file was not of type '"
638-
+ modelFileExtension
635+
+ family.extension()
639636
+ "'. The uploaded file should be a ."
640-
+ modelFileExtension
637+
+ family.extension()
641638
+ " file.");
642639
return;
643640
}
@@ -665,7 +662,7 @@ public static void onImportObjectDetectionModelRequest(Context ctx) {
665662
.addModelProperties(
666663
new ModelProperties(
667664
modelPath,
668-
modelFile.filename().replaceAll("." + modelFileExtension, ""),
665+
modelFile.filename().replaceAll("." + family.extension(), ""),
669666
labels,
670667
width,
671668
height,

0 commit comments

Comments
 (0)