Hugo Flores Garcia commited on
Commit
5bd16c2
1 Parent(s): 91e3ceb

example audio

Browse files
Files changed (3) hide show
  1. app.py +14 -21
  2. conf/interface.yml +2 -2
  3. setup.py +1 -1
app.py CHANGED
@@ -14,22 +14,22 @@ from vampnet.interface import Interface
14
  from vampnet import mask as pmask
15
 
16
  Interface = argbind.bind(Interface)
17
- AudioLoader = argbind.bind(at.data.datasets.AudioLoader)
18
 
19
  conf = argbind.parse_args()
20
 
21
  with argbind.scope(conf):
22
  interface = Interface()
23
- loader = AudioLoader()
24
  print(f"interface device is {interface.device}")
25
 
26
- dataset = at.data.datasets.AudioDataset(
27
- loader,
28
- sample_rate=interface.codec.sample_rate,
29
- duration=interface.coarse.chunk_size_s,
30
- n_examples=5000,
31
- without_replacement=True,
32
- )
33
 
34
  OUT_DIR = Path("gradio-outputs")
35
  OUT_DIR.mkdir(exist_ok=True, parents=True)
@@ -50,15 +50,8 @@ def load_audio(file):
50
  return sig.path_to_file
51
 
52
 
53
- def load_random_audio():
54
- index = np.random.randint(0, len(dataset))
55
- sig = dataset[index]["signal"]
56
- sig = interface.preprocess(sig)
57
-
58
- out_dir = OUT_DIR / "tmp" / str(uuid.uuid4())
59
- out_dir.mkdir(parents=True, exist_ok=True)
60
- sig.write(out_dir / "input.wav")
61
- return sig.path_to_file
62
 
63
 
64
  def _vamp(data, return_mask=False):
@@ -191,7 +184,7 @@ with gr.Blocks() as demo:
191
  label=f"upload some audio (will be randomly trimmed to max of {interface.coarse.chunk_size_s:.2f}s)",
192
  file_types=["audio"]
193
  )
194
- load_random_audio_button = gr.Button("or load random audio")
195
 
196
  input_audio = gr.Audio(
197
  label="input audio",
@@ -206,8 +199,8 @@ with gr.Blocks() as demo:
206
  )
207
 
208
  # connect widgets
209
- load_random_audio_button.click(
210
- fn=load_random_audio,
211
  inputs=[],
212
  outputs=[ input_audio]
213
  )
 
14
  from vampnet import mask as pmask
15
 
16
  Interface = argbind.bind(Interface)
17
+ # AudioLoader = argbind.bind(at.data.datasets.AudioLoader)
18
 
19
  conf = argbind.parse_args()
20
 
21
  with argbind.scope(conf):
22
  interface = Interface()
23
+ # loader = AudioLoader()
24
  print(f"interface device is {interface.device}")
25
 
26
+ # dataset = at.data.datasets.AudioDataset(
27
+ # loader,
28
+ # sample_rate=interface.codec.sample_rate,
29
+ # duration=interface.coarse.chunk_size_s,
30
+ # n_examples=5000,
31
+ # without_replacement=True,
32
+ # )
33
 
34
  OUT_DIR = Path("gradio-outputs")
35
  OUT_DIR.mkdir(exist_ok=True, parents=True)
 
50
  return sig.path_to_file
51
 
52
 
53
+ def load_example_audio():
54
+ return "./assets/example.wav"
 
 
 
 
 
 
 
55
 
56
 
57
  def _vamp(data, return_mask=False):
 
184
  label=f"upload some audio (will be randomly trimmed to max of {interface.coarse.chunk_size_s:.2f}s)",
185
  file_types=["audio"]
186
  )
187
+ load_example_audio_button = gr.Button("or load example audio")
188
 
189
  input_audio = gr.Audio(
190
  label="input audio",
 
199
  )
200
 
201
  # connect widgets
202
+ load_example_audio_button.click(
203
+ fn=load_example_audio,
204
  inputs=[],
205
  outputs=[ input_audio]
206
  )
conf/interface.yml CHANGED
@@ -5,6 +5,6 @@ Interface.coarse_chunk_size_s: 10
5
  Interface.coarse2fine_chunk_size_s: 3
6
  # Interface.wavebeat_ckpt: ./models/wavebeat.pth
7
 
8
- AudioLoader.sources:
9
- - /media/CHONK/null
10
 
 
5
  Interface.coarse2fine_chunk_size_s: 3
6
  # Interface.wavebeat_ckpt: ./models/wavebeat.pth
7
 
8
+ # AudioLoader.sources:
9
+ # - /media/CHONK/null
10
 
setup.py CHANGED
@@ -32,6 +32,6 @@ setup(
32
  "descript-audio-codec @ git+https://github.com/descriptinc/descript-audio-codec.git",
33
  "gradio",
34
  "tensorboardX",
35
- "loralib"
36
  ],
37
  )
 
32
  "descript-audio-codec @ git+https://github.com/descriptinc/descript-audio-codec.git",
33
  "gradio",
34
  "tensorboardX",
35
+ "loralib",
36
  ],
37
  )