Spaces:
Runtime error
Runtime error
change weight file
Browse files33 unmodified lines34353637383940101 unmodified lines14214314414514614714814915015115215315415515615733 unmodified lines# configWEIGHTS = {"Flexible": os.path.join(WEIGHT_DIR, "250312_flexi.pth"),"Forest": os.path.join(WEIGHT_DIR, "230103_randresize_full.pth"),"Urban": os.path.join(WEIGHT_DIR, "urban_trees_Cambridge_20230630.pth"),}101 unmodified linesfname = os.path.basename(path)dest = os.path.join(WEIGHT_DIR, fname)# optional: space check so we fail gracefullytotal, used, free = shutil.disk_usage("/data")need = os.path.getsize(path)if need > free:return f"❌ Not enough space: need {need/1024**2:.2f} MB, free {free/1024**2:.2f} MB."shutil.copy2(path, dest)return f"✅ Saved {fname} to {WEIGHT_DIR}"except Exception as e:return "❌ Upload failed:\n" + traceback.format_exc()def list_persistent():33 unmodified lines34353637383940101 unmodified lines14214314414514614714814915015115215315415515633 unmodified lines# configWEIGHTS = {"Flexible": os.path.join(WEIGHT_DIR, "250312_flexi.pth"),"Forest": os.path.join(WEIGHT_DIR, "250711_tropical_closed_canopy.pth"),"Urban": os.path.join(WEIGHT_DIR, "urban_trees_Cambridge_20230630.pth"),}101 unmodified linesfname = os.path.basename(path)dest = os.path.join(WEIGHT_DIR, fname)total, used, free = shutil.disk_usage("/data")need = os.path.getsize(path)if need > free:return f"Not enough space: need {need/1024**2:.2f} MB, free {free/1024**2:.2f} MB."shutil.copy2(path, dest)return f"Saved {fname} to {WEIGHT_DIR}"except Exception as e:return "Upload failed:\n" + traceback.format_exc()def list_persistent():
app.py+4-5