Rajkumar Pramanik "RJproz commited on
Commit
9c0000e
·
1 Parent(s): 74898b4
Files changed (2) hide show
  1. .DS_Store +0 -0
  2. app.py +12 -10
.DS_Store CHANGED
Binary files a/.DS_Store and b/.DS_Store differ
 
app.py CHANGED
@@ -199,21 +199,23 @@ def generate_speech(description, text, temperature, max_tokens):
199
  audio = audio[2048:]
200
 
201
  # Convert to WAV and save to temporary file
202
- import tempfile
203
- import soundfile as sf
204
 
205
- audio_int16 = (audio * 32767).astype(np.int16)
206
 
207
- # Create temporary file
208
- with tempfile.NamedTemporaryFile(delete=False, suffix='.wav') as tmp_file:
209
- tmp_path = tmp_file.name
210
 
211
- # Save audio
212
- sf.write(tmp_path, audio_int16, AUDIO_SAMPLE_RATE)
213
 
214
- duration = len(audio) / AUDIO_SAMPLE_RATE
215
- status_msg = f"Generated {duration:.2f}s of emotional speech!"
216
 
 
 
217
  return tmp_path, status_msg
218
 
219
  except Exception as e:
 
199
  audio = audio[2048:]
200
 
201
  # Convert to WAV and save to temporary file
202
+ # import tempfile
203
+ # import soundfile as sf
204
 
205
+ # audio_int16 = (audio * 32767).astype(np.int16)
206
 
207
+ # # Create temporary file
208
+ # with tempfile.NamedTemporaryFile(delete=False, suffix='.wav') as tmp_file:
209
+ # tmp_path = tmp_file.name
210
 
211
+ # # Save audio
212
+ # sf.write(tmp_path, audio_int16, AUDIO_SAMPLE_RATE)
213
 
214
+ # duration = len(audio) / AUDIO_SAMPLE_RATE
215
+ # status_msg = f"Generated {duration:.2f}s of emotional speech!"
216
 
217
+ tmp_path = "success"
218
+ status_msg = "success"
219
  return tmp_path, status_msg
220
 
221
  except Exception as e: