Spaces:
Running
Running
2B-Studio: DAW-Studio, neue Modelle (YuE2, TangoFlux, AudioGen, AudioLDM2), Lizenz-Badges, HF-Login, Einswarm Schwarz/Gold
c600f78 verified Download app.py from 2Btainment/2b-studio: direct link, hf CLI and curl.
- Browser
- Download file 1.28 kB
-
https://huggingface.co/spaces/2Btainment/2b-studio/resolve/main/app.py
- Command line
-
hf download hf://spaces/2Btainment/2b-studio/app.py
-
curl -L -o app.py https://huggingface.co/spaces/2Btainment/2b-studio/resolve/main/app.py
1.28 kB
| from __future__ import annotations | |
| import os | |
| from pathlib import Path | |
| import gradio as gr | |
| from studio.ui import CSS, HEAD, THEME, build_app | |
| APP_DIR = Path(__file__).resolve().parent | |
| # Schriften und Hintergründe selbst gehostet (keine Google-Fonts-Requests) | |
| from studio.daw.api import DAW_DIR # noqa: E402 | |
| gr.set_static_paths(paths=[APP_DIR / "static", DAW_DIR]) | |
| def _is_hf_space() -> bool: | |
| """Erkennt die HF-Space-Laufzeitumgebung über alle gängigen Variablen.""" | |
| return bool( | |
| os.environ.get("HF_SPACE_ID") | |
| or os.environ.get("SPACE_ID") | |
| or os.environ.get("SPACE_HOST") | |
| or os.environ.get("SPACE_REPO_NAME") | |
| ) | |
| # Im HF-Space ONUS-Mastering deaktivieren (nur lokal verfügbar). | |
| # Lokal bleibt der volle Funktionsumfang aktiv. | |
| if _is_hf_space() and os.environ.get("STUDIO_SPACE_MODE") is None: | |
| os.environ["STUDIO_SPACE_MODE"] = "1" | |
| demo = build_app() | |
| if __name__ == "__main__": | |
| os.chdir(APP_DIR) # relative /gradio_api/file=static/… URLs | |
| demo.launch( | |
| server_name=os.environ.get("STUDIO_HOST", "0.0.0.0"), | |
| server_port=int(os.environ.get("STUDIO_PORT", os.environ.get("PORT", "7860"))), | |
| share=False, | |
| show_error=True, | |
| theme=THEME, | |
| css=CSS, | |
| head=HEAD, | |
| ) | |