kevinwang676 commited on
Commit
4d74158
1 Parent(s): e6083d1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -1,5 +1,6 @@
1
  import os
2
  import gradio as gr
 
3
 
4
  os.system("pip install kantts -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html")
5
  os.system("pip install numpy==1.22.0")
@@ -35,9 +36,11 @@ inference = pipeline(task=Tasks.text_to_speech, model=model_id)
35
 
36
  def infer(text):
37
  output = inference(input=text)
38
- with open("myfile.wav", mode='bx') as f:
 
 
39
  f.write(output["output_wav"])
40
- return "myfile.wav"
41
 
42
  app = gr.Blocks()
43
 
 
1
  import os
2
  import gradio as gr
3
+ import random
4
 
5
  os.system("pip install kantts -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html")
6
  os.system("pip install numpy==1.22.0")
 
36
 
37
  def infer(text):
38
  output = inference(input=text)
39
+ filename = str(random.randint(1, 1000000000000))
40
+
41
+ with open(filename + "myfile.wav", mode='bx') as f:
42
  f.write(output["output_wav"])
43
+ return filename + "myfile.wav"
44
 
45
  app = gr.Blocks()
46