OpenSound commited on
Commit
e509f51
·
verified ·
1 Parent(s): 9c80a14

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -2,8 +2,8 @@ import gradio as gr
2
  import spaces
3
  import yaml
4
  import torch
5
- # import librosa
6
- import torchaudio
7
  from diffusers import DDIMScheduler
8
  from transformers import AutoProcessor, ClapModel, ClapConfig
9
  from model.udit import UDiT
@@ -119,12 +119,12 @@ def sample_diffusion(mixture, timbre, ddim_steps=50, eta=0, seed=2023, guidance_
119
  def tse(gt_file_input, text_input, num_infer_steps, eta, seed, guidance_scale, guidance_rescale):
120
  reset_scheduler_dtype()
121
  with torch.no_grad():
122
- # mixture, _ = librosa.load(gt_file_input, sr=sample_rate)
123
- mixture, sr = torchaudio.load(gt_file_input)
124
- if sr != sample_rate:
125
- resampler = torchaudio.transforms.Resample(orig_freq=sr, new_freq=sample_rate)
126
- mixture = resampler(mixture)
127
- sr = sample_rate
128
 
129
  # Check the length of the audio in samples
130
  current_length = len(mixture)
 
2
  import spaces
3
  import yaml
4
  import torch
5
+ import librosa
6
+ # import torchaudio
7
  from diffusers import DDIMScheduler
8
  from transformers import AutoProcessor, ClapModel, ClapConfig
9
  from model.udit import UDiT
 
119
  def tse(gt_file_input, text_input, num_infer_steps, eta, seed, guidance_scale, guidance_rescale):
120
  reset_scheduler_dtype()
121
  with torch.no_grad():
122
+ mixture, _ = librosa.load(gt_file_input, sr=sample_rate)
123
+ # mixture, sr = torchaudio.load(gt_file_input)
124
+ # if sr != sample_rate:
125
+ # resampler = torchaudio.transforms.Resample(orig_freq=sr, new_freq=sample_rate)
126
+ # mixture = resampler(mixture)
127
+ # sr = sample_rate
128
 
129
  # Check the length of the audio in samples
130
  current_length = len(mixture)