Anita-19 commited on
Commit
ca163b3
Β·
verified Β·
1 Parent(s): 98275cd

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +3 -7
main.py CHANGED
@@ -310,18 +310,14 @@ def emotion_aware_tts_pipeline(input_text=None, file_input=None):
310
  emotion = emotion_data['label']
311
  confidence = emotion_data['score']
312
 
313
- # Adjust text for speed and pitch based on detected emotion
314
  settings = emotion_settings.get(emotion.lower(), {"pitch": 1.0, "speed": 1.0})
315
- speed = settings["speed"]
316
  pitch = settings["pitch"]
 
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 and speed to reflect more natural speech patterns
323
- adjust_pitch(audio_path, (pitch - 1.0) * 12)
324
- adjust_speed(audio_path, speed)
325
 
326
 
327
  return f"Detected Emotion: {emotion} (Confidence: {confidence:.2f})", audio_path
 
310
  emotion = emotion_data['label']
311
  confidence = emotion_data['score']
312
 
313
+ # Adjust pitch and speed
314
  settings = emotion_settings.get(emotion.lower(), {"pitch": 1.0, "speed": 1.0})
 
315
  pitch = settings["pitch"]
316
+ speed = settings["speed"]
317
 
318
  # Generate audio
319
  audio_path = "output.wav"
320
+ tts_model.tts_to_file(text=input_text, file_path=audio_path, speed=speed, pitch=pitch)
 
 
 
 
321
 
322
 
323
  return f"Detected Emotion: {emotion} (Confidence: {confidence:.2f})", audio_path