Baghdad99 commited on
Commit
e7d026a
·
1 Parent(s): 730fef5
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -43,16 +43,16 @@ def translate_speech(audio):
43
  synthesised_speech = tts(translated_text_str)
44
  print(f"Synthesised speech: {synthesised_speech}") # Print the synthesised speech to see what it contains
45
 
46
- # Check if the synthesised speech contains the expected key
47
- if 'key' in synthesised_speech: # Replace 'key' with the actual key
48
- synthesised_speech_data = synthesised_speech['key'] # Replace 'key' with the actual key
49
  else:
50
- print("The synthesised speech does not contain 'key'") # Replace 'key' with the actual key
51
  return
52
 
53
  # Define the max_range variable
54
  max_range = 32767 # You can adjust this value based on your requirements
55
- synthesised_speech = (synthesised_speech_data.numpy() * max_range).astype(np.int16)
56
 
57
  return 16000, synthesised_speech
58
 
 
43
  synthesised_speech = tts(translated_text_str)
44
  print(f"Synthesised speech: {synthesised_speech}") # Print the synthesised speech to see what it contains
45
 
46
+ # Check if the synthesised speech contains 'audio'
47
+ if 'audio' in synthesised_speech:
48
+ synthesised_speech_data = synthesised_speech['audio']
49
  else:
50
+ print("The synthesised speech does not contain 'audio'")
51
  return
52
 
53
  # Define the max_range variable
54
  max_range = 32767 # You can adjust this value based on your requirements
55
+ synthesised_speech = (synthesised_speech_data * max_range).astype(np.int16)
56
 
57
  return 16000, synthesised_speech
58