Nunchakuka commited on
Commit
8732225
·
1 Parent(s): 9ca6ea1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -3
app.py CHANGED
@@ -71,9 +71,17 @@ def convert(model, src_mic,src_file, tgt):
71
  src = src_mic
72
  elif src_file:
73
  src = src_file
 
 
 
 
74
  if not src:
75
- logging.warning("source or target are not provided")
76
- return
 
 
 
 
77
 
78
  with torch.no_grad():
79
  # tgt
@@ -120,7 +128,7 @@ audio1_mic=gr.Audio(source="microphone", type="filepath", label='record your voi
120
  audio1_file = gr.inputs.Audio(type='filepath', label='or upload an audio file', optional=True)
121
  audio2 = gr.inputs.Audio(label="Reference Audio", type='filepath')
122
  inputs = [model, audio1_mic, audio1_file, audio2]
123
- outputs = gr.outputs.Audio(label="Output Audio", type='filepath')
124
 
125
  title = "FreeVC"
126
  description = "Gradio Demo for FreeVC: Towards High-Quality Text-Free One-Shot Voice Conversion. To use it, simply upload your audio, or click the example to load. Read more at the links below. Note: It seems that the WavLM checkpoint in HuggingFace is a little different from the one used to train FreeVC, which may degrade the performance a bit. In addition, speaker similarity can be largely affected if there are too much silence in the reference audio, so please <strong>trim</strong> it before submitting."
 
71
  src = src_mic
72
  elif src_file:
73
  src = src_file
74
+ #if not src:
75
+ # logging.warning("source or target are not provided")
76
+ # return
77
+
78
  if not src:
79
+ logging.error("Source audio not provided")
80
+ return "Error: Source audio not provided"
81
+
82
+ if not tgt:
83
+ logging.error("Reference audio not provided")
84
+ return "Error: Reference audio not provided"
85
 
86
  with torch.no_grad():
87
  # tgt
 
128
  audio1_file = gr.inputs.Audio(type='filepath', label='or upload an audio file', optional=True)
129
  audio2 = gr.inputs.Audio(label="Reference Audio", type='filepath')
130
  inputs = [model, audio1_mic, audio1_file, audio2]
131
+ outputs = gr.outputs.Audio(label="Output Audio", type='filepath')
132
 
133
  title = "FreeVC"
134
  description = "Gradio Demo for FreeVC: Towards High-Quality Text-Free One-Shot Voice Conversion. To use it, simply upload your audio, or click the example to load. Read more at the links below. Note: It seems that the WavLM checkpoint in HuggingFace is a little different from the one used to train FreeVC, which may degrade the performance a bit. In addition, speaker similarity can be largely affected if there are too much silence in the reference audio, so please <strong>trim</strong> it before submitting."