LPhilp1943 commited on
Commit
6275fb1
1 Parent(s): e9febae

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -52,13 +52,13 @@ def text_to_speech(text):
52
  # If input is already a path to synthesized speech, return it
53
  return text
54
 
55
- def speech_to_speech(input_audio_or_text):
56
- if isinstance(input_audio_or_text, str):
57
- # If input is audio file path, convert speech to text
58
- transcription = speech_to_text(input_audio_or_text)
59
  else:
60
- # If input is text, use it directly
61
- transcription = input_audio_or_text
62
  # Synthesize text to speech and resample to 16kHz
63
  synthesized_speech_path = text_to_speech(transcription)
64
  return synthesized_speech_path
 
52
  # If input is already a path to synthesized speech, return it
53
  return text
54
 
55
+ def speech_to_speech(input_audio, text_input=None):
56
+ if text_input is None:
57
+ # If no text input is provided, convert the input audio to text
58
+ transcription = speech_to_text(input_audio)
59
  else:
60
+ # If text input is provided, use it directly
61
+ transcription = text_input
62
  # Synthesize text to speech and resample to 16kHz
63
  synthesized_speech_path = text_to_speech(transcription)
64
  return synthesized_speech_path