sreepathi-ravikumar commited on
Commit
e888675
·
verified ·
1 Parent(s): 6119e34

Update video2.py

Browse files
Files changed (1) hide show
  1. video2.py +6 -6
video2.py CHANGED
@@ -31,10 +31,10 @@ async def generate_tts(id, lines):
31
  voice = "en-US-JennyNeural"
32
  audio_name = f"audio{id}.mp3"
33
  audio_path = os.path.join(AUDIO_DIR, audio_name)
34
- #listf = lines.split("&&&")
35
- #text = listf[0].strip()
36
- #lang = listf[1].strip()
37
- communicate = edge_tts.Communicate(text=lines[id], voice=voice, rate="+0%")
38
  await communicate.save(audio_path)
39
  if os.path.exists(audio_path):
40
  audio = MP3(audio_path)
@@ -43,8 +43,8 @@ async def generate_tts(id, lines):
43
  return None, None
44
  def audio_func(id, lines):
45
  return asyncio.run(generate_tts(id, lines))
46
- def video_func(id, lines):
47
- duration, audio_path = audio_func(id, lines)
48
  if not duration or not audio_path:
49
  print("Failed to generate audio.")
50
  return None
 
31
  voice = "en-US-JennyNeural"
32
  audio_name = f"audio{id}.mp3"
33
  audio_path = os.path.join(AUDIO_DIR, audio_name)
34
+ listf = lines.split("&&&")
35
+ text = listf[0].strip()
36
+ langvoice = listf[1].strip()
37
+ communicate = edge_tts.Communicate(text=text, voice=voice, rate="+0%")
38
  await communicate.save(audio_path)
39
  if os.path.exists(audio_path):
40
  audio = MP3(audio_path)
 
43
  return None, None
44
  def audio_func(id, lines):
45
  return asyncio.run(generate_tts(id, lines))
46
+ def video_func(id, lines,lang):
47
+ duration, audio_path = audio_func(id, lang)
48
  if not duration or not audio_path:
49
  print("Failed to generate audio.")
50
  return None