Spaces:
Running
on
A100
Running
on
A100
feat: api-server return lyrics in result
Browse files- acestep/api_server.py +14 -0
acestep/api_server.py
CHANGED
|
@@ -847,6 +847,20 @@ def create_app() -> FastAPI:
|
|
| 847 |
if (time_sig_val or "").strip():
|
| 848 |
metas_out["timesignature"] = str(time_sig_val)
|
| 849 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 850 |
def _none_if_na_str(v: Any) -> Optional[str]:
|
| 851 |
if v is None:
|
| 852 |
return None
|
|
|
|
| 847 |
if (time_sig_val or "").strip():
|
| 848 |
metas_out["timesignature"] = str(time_sig_val)
|
| 849 |
|
| 850 |
+
def _ensure_text_meta(field: str, fallback: Optional[str]) -> None:
|
| 851 |
+
existing = metas_out.get(field)
|
| 852 |
+
if isinstance(existing, str):
|
| 853 |
+
stripped = existing.strip()
|
| 854 |
+
if stripped and stripped.upper() != "N/A":
|
| 855 |
+
return
|
| 856 |
+
if fallback is None:
|
| 857 |
+
return
|
| 858 |
+
if fallback.strip():
|
| 859 |
+
metas_out[field] = fallback
|
| 860 |
+
|
| 861 |
+
_ensure_text_meta("caption", req.caption)
|
| 862 |
+
_ensure_text_meta("lyrics", req.lyrics)
|
| 863 |
+
|
| 864 |
def _none_if_na_str(v: Any) -> Optional[str]:
|
| 865 |
if v is None:
|
| 866 |
return None
|