Spaces:
Running
Running
Download studio/adapters/base.py from 2Btainment/2b-studio: direct link, hf CLI and curl.
- Browser
- Download file 855 Bytes
-
https://huggingface.co/spaces/2Btainment/2b-studio/resolve/main/studio/adapters/base.py
- Command line
-
hf download hf://spaces/2Btainment/2b-studio/studio/adapters/base.py
-
curl -L -o base.py https://huggingface.co/spaces/2Btainment/2b-studio/resolve/main/studio/adapters/base.py
855 Bytes
| from __future__ import annotations | |
| from typing import Any, Protocol | |
| from pydantic import BaseModel, Field | |
| from studio.state import Track | |
| class AdapterError(RuntimeError): | |
| """Base class for visible engine failures.""" | |
| class WorkerUnavailableError(AdapterError): | |
| pass | |
| class WorkerTimeoutError(AdapterError): | |
| pass | |
| class DummyAudioError(AdapterError): | |
| pass | |
| class InvalidAudioError(AdapterError): | |
| pass | |
| class GenerateRequest(BaseModel): | |
| model_id: str | |
| genre_style_instruments: str | |
| lyrics: str = "" | |
| negative: str = "" | |
| duration_s: int = Field(ge=1, le=300) | |
| advanced: dict[str, Any] = Field(default_factory=dict) | |
| class MusicAdapter(Protocol): | |
| def model_ids(self) -> tuple[str, ...]: ... | |
| def health(self) -> bool: ... | |
| def generate(self, request: GenerateRequest) -> Track: ... | |