yourusername commited on
Commit
ac16f4c
β€’
1 Parent(s): 66a6dc0

:beers: cheers

Browse files
Files changed (2) hide show
  1. README.md +2 -2
  2. app.py +17 -4
README.md CHANGED
@@ -1,6 +1,6 @@
1
  ---
2
- title: Deepafx St
3
- emoji: 🐒
4
  colorFrom: red
5
  colorTo: gray
6
  sdk: gradio
 
1
  ---
2
+ title: Audio Style Transfer
3
+ emoji: πŸ”₯πŸ—£οΈπŸŽ΅πŸ”₯
4
  colorFrom: red
5
  colorTo: gray
6
  sdk: gradio
app.py CHANGED
@@ -8,17 +8,24 @@ from huggingface_hub import hf_hub_download
8
  from deepafx_st.system import System
9
  from deepafx_st.utils import DSPMode
10
 
11
- system = System.load_from_checkpoint(
12
  hf_hub_download("nateraw/deepafx-st-libritts-autodiff", "lit_model.ckpt"), batch_size=1
13
  ).eval()
 
 
 
14
 
15
  gpu = torch.cuda.is_available()
16
 
17
  if gpu:
18
- system.to("cuda")
 
 
 
 
19
 
 
20
 
21
- def process(input_path, reference_path):
22
  # load audio data
23
  x, x_sr = torchaudio.load(input_path)
24
  r, r_sr = torchaudio.load(reference_path)
@@ -69,12 +76,18 @@ def process(input_path, reference_path):
69
 
70
  gr.Interface(
71
  fn=process,
72
- inputs=[gr.Audio(type="filepath"), gr.Audio(type="filepath")],
73
  outputs="audio",
74
  examples=[
75
  [
76
  hf_hub_download("nateraw/examples", "voice_raw.wav", repo_type="dataset", cache_dir="./data"),
77
  hf_hub_download("nateraw/examples", "voice_produced.wav", repo_type="dataset", cache_dir="./data"),
 
 
 
 
 
 
78
  ],
79
  ],
80
  title="DeepAFx-ST",
 
8
  from deepafx_st.system import System
9
  from deepafx_st.utils import DSPMode
10
 
11
+ system_speech = System.load_from_checkpoint(
12
  hf_hub_download("nateraw/deepafx-st-libritts-autodiff", "lit_model.ckpt"), batch_size=1
13
  ).eval()
14
+ system_music = System.load_from_checkpoint(
15
+ hf_hub_download("nateraw/deepafx-st-jamendo-autodiff", "lit_model.ckpt"), batch_size=1
16
+ ).eval()
17
 
18
  gpu = torch.cuda.is_available()
19
 
20
  if gpu:
21
+ system_speech.to("cuda")
22
+ system_music.to("cuda")
23
+
24
+
25
+ def process(input_path, reference_path, model):
26
 
27
+ system = system_speech if model == "speech" else system_music
28
 
 
29
  # load audio data
30
  x, x_sr = torchaudio.load(input_path)
31
  r, r_sr = torchaudio.load(reference_path)
 
76
 
77
  gr.Interface(
78
  fn=process,
79
+ inputs=[gr.Audio(type="filepath"), gr.Audio(type="filepath"), gr.Dropdown(["speech", "music"], value="speech")],
80
  outputs="audio",
81
  examples=[
82
  [
83
  hf_hub_download("nateraw/examples", "voice_raw.wav", repo_type="dataset", cache_dir="./data"),
84
  hf_hub_download("nateraw/examples", "voice_produced.wav", repo_type="dataset", cache_dir="./data"),
85
+ "speech",
86
+ ],
87
+ [
88
+ hf_hub_download("nateraw/examples", "nys_of_mind.wav", repo_type="dataset", cache_dir="./data"),
89
+ hf_hub_download("nateraw/examples", "world_is_yours_highpass.wav", repo_type="dataset", cache_dir="./data"),
90
+ "music",
91
  ],
92
  ],
93
  title="DeepAFx-ST",