jbilcke-hf HF staff commited on
Commit
9fb3a35
·
1 Parent(s): 2a3efb7

fix for options

Browse files
Files changed (1) hide show
  1. src/index.mts +15 -2
src/index.mts CHANGED
@@ -32,7 +32,21 @@ app.post("/", async (req: Request, res: Response, _next: NextFunction) => {
32
  return res.status(503).send("Service Unavailable");
33
  }
34
 
35
- const options: ColmapOptions = req.body;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  let dataFile: fileUpload.UploadedFile | Buffer = Buffer.from("");
37
 
38
  try {
@@ -51,7 +65,6 @@ app.post("/", async (req: Request, res: Response, _next: NextFunction) => {
51
  dataFile = req.files.data;
52
  }
53
 
54
- const { projectTempDir, outputTempDir, imageFolder } = setupDirectories();
55
  const filePath = await handleFileStorage(dataFile, projectTempDir);
56
 
57
  await generateImagesFromData(imageFolder, filePath);
 
32
  return res.status(503).send("Service Unavailable");
33
  }
34
 
35
+ const { projectTempDir, outputTempDir, imageFolder } = setupDirectories();
36
+
37
+ const defaultOptions: ColmapOptions = {
38
+ command: 'automatic_reconstructor',
39
+ parameters: {
40
+ workspace_path: projectTempDir + '/images',
41
+ image_path: projectTempDir + '/images',
42
+ },
43
+ };
44
+
45
+ const requestBody = typeof req.body === "object" ? req.body : undefined;
46
+ const options: ColmapOptions = {...defaultOptions, ...requestBody};
47
+
48
+ console.log("options:", options);
49
+
50
  let dataFile: fileUpload.UploadedFile | Buffer = Buffer.from("");
51
 
52
  try {
 
65
  dataFile = req.files.data;
66
  }
67
 
 
68
  const filePath = await handleFileStorage(dataFile, projectTempDir);
69
 
70
  await generateImagesFromData(imageFolder, filePath);