Spaces:
r3gm
/
Running

r3gm commited on
Commit
167ad04
1 Parent(s): f39cb66

fix load audio or not?

Browse files
Files changed (1) hide show
  1. app.py +13 -6
app.py CHANGED
@@ -1738,6 +1738,15 @@ import edge_tts
1738
  import asyncio
1739
 
1740
 
 
 
 
 
 
 
 
 
 
1741
 
1742
 
1743
  def custom_voice(
@@ -1985,10 +1994,8 @@ def GradioSetup(UTheme=gr.themes.Soft()):
1985
  input_audio1.select(fn=lambda:'',inputs=[],outputs=[input_audio0])
1986
  input_audio0.input(fn=lambda:'',inputs=[],outputs=[input_audio1])
1987
 
1988
- dropbox.upload(fn=save_to_wav2, inputs=[dropbox], outputs=[input_audio0])
1989
- dropbox.upload(fn=easy_infer.change_choices2, inputs=[], outputs=[input_audio1])
1990
- record_button.change(fn=save_to_wav, inputs=[record_button], outputs=[input_audio0])
1991
- record_button.change(fn=easy_infer.change_choices2, inputs=[], outputs=[input_audio1])
1992
 
1993
  best_match_index_path1 = match_index(sid0.value) # Get initial index from default sid0 (first voice model in list)
1994
 
@@ -2087,7 +2094,7 @@ def GradioSetup(UTheme=gr.themes.Soft()):
2087
  visible = (not rvc_globals.NotesOrHertz) and (f0method0.value != 'rmvpe'),
2088
  )
2089
  maxpitch_txtbox = gr.Textbox(
2090
- label = i18n("Max pitch:"),
2091
  info = i18n("Specify max pitch for inference [NOTE][OCTAVE]"),
2092
  placeholder = "C6",
2093
  visible = (rvc_globals.NotesOrHertz) and (f0method0.value != 'rmvpe'),
@@ -2941,7 +2948,7 @@ def GradioSetup(UTheme=gr.themes.Soft()):
2941
  vc_output2 = gr.Audio(label=i18n("Export audio (click on the three dots in the lower right corner to download)"), type='filepath')
2942
 
2943
  dropbox.upload(fn=save_to_wav2, inputs=[dropbox], outputs=[input_audio1])
2944
- dropbox.upload(fn=easy_infer.change_choices2, inputs=[], outputs=[input_audio1])
2945
 
2946
  refresh_button.click(
2947
  fn=lambda: change_choices3(),
 
1738
  import asyncio
1739
 
1740
 
1741
+ def change_choices_fix():
1742
+ audio_paths=[]
1743
+ for filename in os.listdir("./audios"):
1744
+ if filename.endswith(('wav', 'mp3', 'flac', 'ogg', 'opus',
1745
+ 'm4a', 'mp4', 'aac', 'alac', 'wma',
1746
+ 'aiff', 'webm', 'ac3')):
1747
+ audio_paths.append(os.path.join('./audios',filename).replace('\\', '/'))
1748
+ print(audio_paths)
1749
+ return {"choices": sorted(audio_paths), "__type__": "update"}
1750
 
1751
 
1752
  def custom_voice(
 
1994
  input_audio1.select(fn=lambda:'',inputs=[],outputs=[input_audio0])
1995
  input_audio0.input(fn=lambda:'',inputs=[],outputs=[input_audio1])
1996
 
1997
+ dropbox.upload(fn=save_to_wav2, inputs=[dropbox], outputs=[input_audio0]).then(fn=change_choices_fix, inputs=[], outputs=[input_audio1])
1998
+ record_button.change(fn=save_to_wav, inputs=[record_button], outputs=[input_audio0]).then(fn=change_choices_fix, inputs=[], outputs=[input_audio1])
 
 
1999
 
2000
  best_match_index_path1 = match_index(sid0.value) # Get initial index from default sid0 (first voice model in list)
2001
 
 
2094
  visible = (not rvc_globals.NotesOrHertz) and (f0method0.value != 'rmvpe'),
2095
  )
2096
  maxpitch_txtbox = gr.Textbox(
2097
+ label = i18n
2098
  info = i18n("Specify max pitch for inference [NOTE][OCTAVE]"),
2099
  placeholder = "C6",
2100
  visible = (rvc_globals.NotesOrHertz) and (f0method0.value != 'rmvpe'),
 
2948
  vc_output2 = gr.Audio(label=i18n("Export audio (click on the three dots in the lower right corner to download)"), type='filepath')
2949
 
2950
  dropbox.upload(fn=save_to_wav2, inputs=[dropbox], outputs=[input_audio1])
2951
+ dropbox.upload(fn=change_choices_fix, inputs=[], outputs=[input_audio1])
2952
 
2953
  refresh_button.click(
2954
  fn=lambda: change_choices3(),