MCPcopy Create free account
hub / github.com/Audio-AGI/AudioSep / Predictor

Class Predictor

predict.py:10–31  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8
9
10class 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)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected