Spaces:
Running
Running
Update main.py
Browse files
main.py
CHANGED
@@ -297,6 +297,7 @@ emotion_settings = {
|
|
297 |
}
|
298 |
|
299 |
|
|
|
300 |
def emotion_aware_tts_pipeline(input_text=None, file_input=None):
|
301 |
try:
|
302 |
# Get text from input or file
|
@@ -317,11 +318,8 @@ def emotion_aware_tts_pipeline(input_text=None, file_input=None):
|
|
317 |
|
318 |
# Generate audio
|
319 |
audio_path = "output.wav"
|
320 |
-
tts_model.tts_to_file(text=input_text, file_path=audio_path)
|
321 |
|
322 |
-
# Adjust pitch
|
323 |
-
pitch_factor = (pitch - 1.0) * 12 # Convert to semitones for librosa
|
324 |
-
adjust_pitch(audio_path, pitch_factor)
|
325 |
|
326 |
|
327 |
return f"Detected Emotion: {emotion} (Confidence: {confidence:.2f})", audio_path
|
|
|
297 |
}
|
298 |
|
299 |
|
300 |
+
# Function to process text or file input and generate audio
|
301 |
def emotion_aware_tts_pipeline(input_text=None, file_input=None):
|
302 |
try:
|
303 |
# Get text from input or file
|
|
|
318 |
|
319 |
# Generate audio
|
320 |
audio_path = "output.wav"
|
321 |
+
tts_model.tts_to_file(text=input_text, file_path=audio_path, speed=speed, pitch=pitch)
|
322 |
|
|
|
|
|
|
|
323 |
|
324 |
|
325 |
return f"Detected Emotion: {emotion} (Confidence: {confidence:.2f})", audio_path
|