Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README.md #26

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,21 @@ Download [model weights](https://huggingface.co/spaces/Audio-AGI/AudioSep/tree/m
from pipeline import build_audiosep, inference
import torch

# Check for GPU availability and set the device
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')

# Build the AudioSeparation (AudioSep) model
model = build_audiosep(
config_yaml='config/audiosep_base.yaml',
checkpoint_path='checkpoint/audiosep_base_4M_steps.ckpt',
device=device)

# Specify the input audio file, textual description, and output file
audio_file = 'path_to_audio_file'
text = 'textual_description'
output_file='separated_audio.wav'

# Perform audio source separation
# AudioSep processes the audio at 32 kHz sampling rate
inference(model, audio_file, text, output_file, device)
```
Expand All @@ -59,21 +63,26 @@ Download [model weights](https://huggingface.co/spaces/Audio-AGI/AudioSep/tree/m
To load directly from Hugging Face, you can do the following:

```python
import torch
from models.audiosep import AudioSep
from utils import get_ss_model
import torch
from pipeline import inference

# Check for GPU availability
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')

# Load the source separation model from the provided config and model_path
ss_model = get_ss_model('config/audiosep_base.yaml')

model = AudioSep.from_pretrained("nielsr/audiosep-demo", ss_model=ss_model)

# Specify input and output files
audio_file = 'path_to_audio_file'
text = 'textual_description'
output_file='separated_audio.wav'

# AudioSep processes the audio at 32 kHz sampling rate

# AudioSep processes the audio at 32 kHz sampling rate
# Run audio source separation
inference(model, audio_file, text, output_file, device)
```
<hr>
Expand Down