Spaces:
Sleeping
Sleeping
Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -189,6 +189,21 @@ def measure(audio_path: str) -> str:
|
|
| 189 |
return json.dumps(rep.to_dict(), indent=2)
|
| 190 |
|
| 191 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 192 |
def ableton_plan(audio_path: str, genre: str = "Dubstep / Riddim",
|
| 193 |
source: str = "Full mix / master",
|
| 194 |
track_index: str = "$MASTER") -> str:
|
|
@@ -346,6 +361,7 @@ with gr.Blocks(title="Second Ear") as demo:
|
|
| 346 |
analyse_capture,
|
| 347 |
inputs=[state, genre, source, live_intent, live_llm],
|
| 348 |
outputs=[cap_report, cap_text, cap_json],
|
|
|
|
| 349 |
)
|
| 350 |
|
| 351 |
# -------------------------------------------------------- bounce
|
|
@@ -401,10 +417,12 @@ with gr.Blocks(title="Second Ear") as demo:
|
|
| 401 |
api_name="ableton_plan",
|
| 402 |
)
|
| 403 |
|
| 404 |
-
|
| 405 |
-
|
| 406 |
-
|
| 407 |
-
)
|
|
|
|
|
|
|
| 408 |
|
| 409 |
|
| 410 |
if __name__ == "__main__":
|
|
|
|
| 189 |
return json.dumps(rep.to_dict(), indent=2)
|
| 190 |
|
| 191 |
|
| 192 |
+
def health() -> str:
|
| 193 |
+
"""Report which optional layers are live: the CLAP semantic ear and the
|
| 194 |
+
written critique. Returns JSON."""
|
| 195 |
+
return json.dumps({
|
| 196 |
+
"semantic": semantic.SEMANTIC.status(),
|
| 197 |
+
"semantic_ready": semantic.SEMANTIC.ready,
|
| 198 |
+
"critique": llm.available()[1],
|
| 199 |
+
}, indent=2)
|
| 200 |
+
|
| 201 |
+
|
| 202 |
+
def _status_line() -> str:
|
| 203 |
+
return (f"<sub>Semantic ear: {semantic.SEMANTIC.status()} · "
|
| 204 |
+
f"written critique: {llm.available()[1]}</sub>")
|
| 205 |
+
|
| 206 |
+
|
| 207 |
def ableton_plan(audio_path: str, genre: str = "Dubstep / Riddim",
|
| 208 |
source: str = "Full mix / master",
|
| 209 |
track_index: str = "$MASTER") -> str:
|
|
|
|
| 361 |
analyse_capture,
|
| 362 |
inputs=[state, genre, source, live_intent, live_llm],
|
| 363 |
outputs=[cap_report, cap_text, cap_json],
|
| 364 |
+
api_name=False, # gr.State can't cross the MCP boundary
|
| 365 |
)
|
| 366 |
|
| 367 |
# -------------------------------------------------------- bounce
|
|
|
|
| 417 |
api_name="ableton_plan",
|
| 418 |
)
|
| 419 |
|
| 420 |
+
# Rendered per page load, not at import — the CLAP ear finishes warming
|
| 421 |
+
# up well after the Blocks tree is built.
|
| 422 |
+
status = gr.Markdown(_status_line())
|
| 423 |
+
demo.load(_status_line, outputs=status, api_name=False)
|
| 424 |
+
gr.Button("health", visible=False).click(
|
| 425 |
+
health, outputs=gr.Textbox(visible=False), api_name="health")
|
| 426 |
|
| 427 |
|
| 428 |
if __name__ == "__main__":
|