feat: add descriptive model naming and inline rename
- Auto-generate model names: {arch}-{labelType}-{epochs}ep-{classNames}-{YYYYMMDD}
- Add PATCH /api/models/{id}/rename endpoint
- Inline rename UI on Models & Training page
- Download filename uses model name instead of v{N}
- DB migration: add name column to model_versions
- Update all docs to reflect new naming convention
This commit is contained in:
1 parent
51e74a253e
commit
d170cff0e4
14 files changed
+166
-32
No files matched your search
+17
-1
@@ -57,8 +57,9 @@ def download_weights(model_id: int):
|
||||
version = training.get_version(model_id)
|
||||
if version is None or not os.path.isfile(version["weights_path"]):
|
||||
raise HTTPException(404, "No weights for that version")
|
||||
name = version.get('name') or f"v{version['version']}"
|
||||
return FileResponse(version["weights_path"], media_type="application/octet-stream",
|
||||
filename=f"v{version['version']}-best.pt")
|
||||
filename=f"{name}-best.pt")
|
||||
|
||||
|
||||
@router.post("/api/models/{model_id}/promote")
|
||||
@@ -67,3 +68,18 @@ def promote_model(model_id: int) -> dict:
|
||||
return training.promote(model_id)
|
||||
except training.TrainingError as exc:
|
||||
raise HTTPException(400, str(exc))
|
||||
|
||||
|
||||
class RenameRequest(BaseModel):
|
||||
name: str
|
||||
|
||||
|
||||
@router.patch("/api/models/{model_id}/rename")
|
||||
def rename_model(model_id: int, request: RenameRequest) -> dict:
|
||||
try:
|
||||
version = training.rename(model_id, request.name)
|
||||
if version is None:
|
||||
raise HTTPException(404, "No such model version")
|
||||
return version
|
||||
except training.TrainingError as exc:
|
||||
raise HTTPException(400, str(exc))
|
||||
Reference in new issue
Block a user