| 8 | |
| 9 | |
| 10 | class Predictor(BasePredictor): |
| 11 | def setup(self) -> None: |
| 12 | """Load the model into memory to make running multiple predictions efficient""" |
| 13 | |
| 14 | self.model = build_audiosep( |
| 15 | config_yaml="config/audiosep_base.yaml", |
| 16 | checkpoint_path="checkpoint/audiosep_base_4M_steps.ckpt", |
| 17 | device="cuda", |
| 18 | ) |
| 19 | |
| 20 | def predict( |
| 21 | self, |
| 22 | audio_file: Path = Input(description="Input audio file."), |
| 23 | text: str = Input(description="Input text.", default="water drops"), |
| 24 | ) -> Path: |
| 25 | """Run a single prediction on the model""" |
| 26 | |
| 27 | output_file = "/tmp/separated_audio.wav" |
| 28 | |
| 29 | # AudioSep processes the audio at 32 kHz sampling rate |
| 30 | inference(self.model, str(audio_file), text, output_file, "cuda") |
| 31 | return Path(output_file) |
nothing calls this directly
no outgoing calls
no test coverage detected