bluenevus commited on
Commit
49dd13b
·
verified ·
1 Parent(s): 310ebea

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -9,6 +9,7 @@ import logging
9
  import os
10
  import spaces
11
  import warnings
 
12
 
13
  # Set up logging
14
  logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
@@ -125,9 +126,14 @@ def text_to_speech(text, voice):
125
  raise
126
 
127
  def mel_to_audio(mel):
128
- # Implement proper mel to audio conversion here
129
- # For now, we'll return a placeholder audio
130
- return np.zeros(24000, dtype=np.float32) # Placeholder: 1 second of silence
 
 
 
 
 
131
 
132
  @spaces.GPU()
133
  def render_podcast(api_key, script, voice1, voice2, num_hosts):
 
9
  import os
10
  import spaces
11
  import warnings
12
+ import librosa
13
 
14
  # Set up logging
15
  logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
 
126
  raise
127
 
128
  def mel_to_audio(mel):
129
+ try:
130
+ # Convert mel spectrogram to audio using librosa
131
+ audio = librosa.feature.inverse.mel_to_audio(mel, sr=24000, n_iter=10)
132
+ return audio
133
+ except Exception as e:
134
+ logger.error(f"Error in mel_to_audio conversion: {str(e)}")
135
+ # Return silence if conversion fails
136
+ return np.zeros(24000, dtype=np.float32)
137
 
138
  @spaces.GPU()
139
  def render_podcast(api_key, script, voice1, voice2, num_hosts):