lorneluo commited on
Commit
7db9974
β€’
1 Parent(s): 11a4759

change default audio model

Browse files
Files changed (1) hide show
  1. txt2video.py +14 -8
txt2video.py CHANGED
@@ -51,21 +51,27 @@ def main(job_id, text, video_url):
51
 
52
  def gen_voice(text, audio_path):
53
  ogg_path = Path(audio_path).with_suffix('.ogg')
54
- client = Client("https://digitalxingtong-xingtong-3da-bert-vits2.hf.space/")
 
 
 
 
 
 
 
55
  result = client.predict(
56
- text, # str in 'Text' Textbox component
57
- "ign", # str (Option from: ['ign']) in 'Speaker' Dropdown component
58
  0.2, # int | float (numeric value between 0 and 1) in 'θ―­θ°ƒε˜εŒ–' Slider component
59
  0.6, # int | float (numeric value between 0.1 and 1.5) in 'ζ„Ÿζƒ…ε˜εŒ–' Slider component
60
  0.8, # int | float (numeric value between 0.1 and 1.4) in 'ιŸ³θŠ‚ε‘ιŸ³ι•ΏεΊ¦ε˜εŒ–' Slider component
61
- 1, # int | float (numeric value between 0.1 and 2) in 'θ―­ι€Ÿ' Slider component
62
  fn_index=0
63
  )
64
- print(result)
65
- success, audio_file, ogg_file = result
66
- print(success, audio_file, ogg_file)
67
  shutil.move(audio_file, audio_path)
68
- shutil.move(ogg_file, ogg_path)
69
 
70
 
71
  if __name__ == '__main__':
 
51
 
52
  def gen_voice(text, audio_path):
53
  ogg_path = Path(audio_path).with_suffix('.ogg')
54
+ client = Client("https://digitalxingtong-ign-longread-bert-vits2.hf.space/")
55
+ if os.path.isabs(text):
56
+ path = text
57
+ else:
58
+ current_folder = os.path.dirname(os.path.abspath(__file__))
59
+ path = os.path.join(current_folder, 'input.txt')
60
+ with open(path, 'w') as file:
61
+ file.write(text)
62
  result = client.predict(
63
+ path,
64
+ # str (filepath or URL to file) in 'εœ¨θΏ™ι‡ŒδΈŠδΌ TXTζ–‡δ»Ά' File component
65
  0.2, # int | float (numeric value between 0 and 1) in 'θ―­θ°ƒε˜εŒ–' Slider component
66
  0.6, # int | float (numeric value between 0.1 and 1.5) in 'ζ„Ÿζƒ…ε˜εŒ–' Slider component
67
  0.8, # int | float (numeric value between 0.1 and 1.4) in 'ιŸ³θŠ‚ε‘ιŸ³ι•ΏεΊ¦ε˜εŒ–' Slider component
68
+ 0.95, # int | float (numeric value between 0.1 and 2) in 'θ―­ι€Ÿ' Slider component
69
  fn_index=0
70
  )
71
+
72
+ audio_file = result
73
+ print(audio_file)
74
  shutil.move(audio_file, audio_path)
 
75
 
76
 
77
  if __name__ == '__main__':