| @app.get("/list-files/")
|
| async def images(i_dir: str, o_dir: str):
|
| """ Returns the list of files."""
|
| spot_detection.input_img_dir = i_dir
|
| spot_detection.output_img_dir = o_dir
|
| try:
|
| spot_detection.check_folders()
|
| except FileExistsError:
|
| raise HTTPException(
|
| status_code=404, detail="Could not find the selected folder.")
|
| except CountAgenCreationError:
|
| raise HTTPException(
|
| status_code=501, detail="Could not create a output folder.")
|
|
|
| files = [asdict(img) for img in spot_detection.list_of_files()]
|
|
|
| return {"items": files}
|