qinzhu commited on
Commit
6cb0a2f
·
1 Parent(s): 6da137c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -9
app.py CHANGED
@@ -30,17 +30,17 @@ def audio_postprocess(self, y):
30
  data = audio_postprocess_ori(self, y)
31
  if data is None:
32
  return None
33
- # return gr_processing_utils.encode_url_or_file_to_base64(data["name"])
34
  # byte_data = data["name"].encode("utf-8") # 将字符串转换为字节
35
  # return base64.b64encode(byte_data)
36
- print(data['name'])
37
- audio = AudioSegment.from_file(data["name"], format="wav")
38
- audio_buffer = io.BytesIO()
39
- audio.export(audio_buffer, format="wav")
40
- audio_buffer.seek(0)
41
- base64_audio = base64.b64encode(audio_buffer.read()).decode("utf-8")
42
 
43
- return "data:audio/wav;base64,"+base64_audio
44
 
45
  gr.Audio.postprocess = audio_postprocess
46
 
@@ -339,4 +339,4 @@ if __name__ == '__main__':
339
  "- [https://github.com/luoyily/MoeTTS](https://github.com/luoyily/MoeTTS)\n"
340
  "- [https://github.com/Francis-Komizu/Sovits](https://github.com/Francis-Komizu/Sovits)"
341
  )
342
- app.queue(concurrency_count=3).launch(share=args.share,server_name='0.0.0.0')
 
30
  data = audio_postprocess_ori(self, y)
31
  if data is None:
32
  return None
33
+ return gr_processing_utils.encode_url_or_file_to_base64(data["name"])
34
  # byte_data = data["name"].encode("utf-8") # 将字符串转换为字节
35
  # return base64.b64encode(byte_data)
36
+ # print(data['name'])
37
+ # audio = AudioSegment.from_file(data["name"], format="wav")
38
+ # audio_buffer = io.BytesIO()
39
+ # audio.export(audio_buffer, format="wav")
40
+ # audio_buffer.seek(0)
41
+ # base64_audio = base64.b64encode(audio_buffer.read()).decode("utf-8")
42
 
43
+ # return "data:audio/wav;base64,"+base64_audio
44
 
45
  gr.Audio.postprocess = audio_postprocess
46
 
 
339
  "- [https://github.com/luoyily/MoeTTS](https://github.com/luoyily/MoeTTS)\n"
340
  "- [https://github.com/Francis-Komizu/Sovits](https://github.com/Francis-Komizu/Sovits)"
341
  )
342
+ app.queue(concurrency_count=3).launch(share=args.share)