Files changed (1) hide show
  1. app.py +20 -14
app.py CHANGED
@@ -1,24 +1,30 @@
1
- import os
2
- os.system('pip install gradio==2.3.0a0')
3
- os.system('pip install voicefixer --upgrade')
4
- from voicefixer import VoiceFixer
5
  import gradio as gr
 
 
6
  voicefixer = VoiceFixer()
7
- def inference(audio,mode):
8
- voicefixer.restore(input=audio.name, # input wav file path
9
- output="output.wav", # output wav file path
10
- cuda=False, # whether to use gpu acceleration
11
- mode = int(mode)) # You can try out mode 0, 1 to find out the best result
12
- return 'output.wav'
13
 
14
- inputs = [gr.inputs.Audio(type="file", label="Input Audio"),gr.inputs.Radio(choices=['0','1','2'], type="value", default='0', label='mode')]
15
- outputs = gr.outputs.Audio(type="file",label="Output Audio")
 
 
 
 
16
 
 
 
 
17
 
18
  title = "Voice Fixer"
19
  description = "Gradio demo for VoiceFixer: Toward General Speech Restoration With Neural Vocoder. To use it, simply add your audio, or click one of the examples to load them. Read more at the links below."
20
  article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2109.13731' target='_blank'>VoiceFixer: Toward General Speech Restoration With Neural Vocoder</a> | <a href='https://github.com/haoheliu/voicefixer_main' target='_blank'>Github Repo</a></p>"
21
 
22
- examples=[['bruce.wav','2']]
23
 
24
- gr.Interface(inference, inputs, outputs, title=title, description=description, article=article, examples=examples, enable_queue=True).launch()
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
+ from voicefixer import VoiceFixer
3
+
4
  voicefixer = VoiceFixer()
 
 
 
 
 
 
5
 
6
+ def inference(audio, mode):
7
+ voicefixer.restore(input=audio.name,
8
+ output="output.wav",
9
+ cuda=False,
10
+ mode=int(mode))
11
+ return "output.wav"
12
 
13
+ input_audio = gr.inputs.Audio(label="Input Audio")
14
+ mode = gr.inputs.Radio(choices=['0', '1', '2'], label="Mode", default='0')
15
+ output_audio = gr.outputs.Audio(label="Output Audio")
16
 
17
  title = "Voice Fixer"
18
  description = "Gradio demo for VoiceFixer: Toward General Speech Restoration With Neural Vocoder. To use it, simply add your audio, or click one of the examples to load them. Read more at the links below."
19
  article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2109.13731' target='_blank'>VoiceFixer: Toward General Speech Restoration With Neural Vocoder</a> | <a href='https://github.com/haoheliu/voicefixer_main' target='_blank'>Github Repo</a></p>"
20
 
21
+ examples = [["bruce.wav", "2"]]
22
 
23
+ gr.Interface(inference,
24
+ inputs=[input_audio, mode],
25
+ outputs=output_audio,
26
+ title=title,
27
+ description=description,
28
+ article=article,
29
+ examples=examples,
30
+ enable_queue=True).launch()