Jihuai commited on
Commit
7c3f87e
·
1 Parent(s): 0228637

download querier from hf directly; remove examples

Browse files
Files changed (2) hide show
  1. app.py +0 -12
  2. core/models/e2e/querier/passt.py +3 -1
app.py CHANGED
@@ -140,18 +140,6 @@ with gr.Blocks() as demo:
140
  outputs=[out_audio, status]
141
  )
142
 
143
- # 示例部分
144
- gr.Examples(
145
- examples=[
146
- ["examples/noisy_1.wav", "audio", "examples/query_1.wav", ""],
147
- ["examples/noisy_2.wav", "text", "", "提取人声"],
148
- ["examples/noisy_3.wav", "text", "", "去除背景噪声"],
149
- ],
150
- inputs=[inp_audio, query_type, inp_query_audio, inp_query_text],
151
- label="样例音频",
152
- examples_per_page=3,
153
- )
154
-
155
  # Queue: keep a small queue to avoid OOM
156
  demo.queue(max_size=8) # 减少队列大小,因为现在需要更多资源
157
  demo.launch()
 
140
  outputs=[out_audio, status]
141
  )
142
 
 
 
 
 
 
 
 
 
 
 
 
 
143
  # Queue: keep a small queue to avoid OOM
144
  demo.queue(max_size=8) # 减少队列大小,因为现在需要更多资源
145
  demo.launch()
core/models/e2e/querier/passt.py CHANGED
@@ -1,3 +1,4 @@
 
1
  import torch
2
  import torchaudio as ta
3
  from hear21passt.base import get_basic_model
@@ -17,7 +18,8 @@ class Passt(nn.Module):
17
  super().__init__()
18
 
19
  self.passt = laion_clap.CLAP_Module(enable_fusion=False, amodel='HTSAT-base')
20
- self.passt.load_ckpt('checkpoints/querier/music_speech_epoch_15_esc_89.25.pt')
 
21
  self.resample = ta.transforms.Resample(
22
  orig_freq=original_fs, new_freq=passt_fs
23
  ).eval()
 
1
+ from huggingface_hub import hf_hub_download
2
  import torch
3
  import torchaudio as ta
4
  from hear21passt.base import get_basic_model
 
18
  super().__init__()
19
 
20
  self.passt = laion_clap.CLAP_Module(enable_fusion=False, amodel='HTSAT-base')
21
+ ckpt_path = hf_hub_download(repo_id="lukewys/laion_clap", filename="music_speech_epoch_15_esc_89.25.pt")
22
+ self.passt.load_ckpt(ckpt_path)
23
  self.resample = ta.transforms.Resample(
24
  orig_freq=original_fs, new_freq=passt_fs
25
  ).eval()