Spaces:
Runtime error
Runtime error
James Ball commited on
Commit ·
25fc09d
1
Parent(s): ce8e246
Fix example button: resolve relative path before chdir
Browse filesEXAMPLE_FILE is a relative path ("./example_danum_tile.tif") but
run_detectree2 does os.chdir(workdir) before shutil.copy2, so the
relative path resolves against the temp directory instead of /app.
os.path.abspath() before the chdir fixes this.
Made-with: Cursor
67 unmodified lines68697071727367 unmodified linesBUFFER, TILE_W, TILE_H = 30, 40, 40def run_detectree2(geotiff_path: str, environment: str, conf_threshold: float, progress=None):original_cwd = os.getcwd()workdir = tempfile.mkdtemp(prefix="dtr2_")tiles_dir = os.path.join(workdir, "tilespred")67 unmodified lines6869707172737467 unmodified linesBUFFER, TILE_W, TILE_H = 30, 40, 40def run_detectree2(geotiff_path: str, environment: str, conf_threshold: float, progress=None):geotiff_path = os.path.abspath(geotiff_path)original_cwd = os.getcwd()workdir = tempfile.mkdtemp(prefix="dtr2_")tiles_dir = os.path.join(workdir, "tilespred")
app.py+1