Tmeena commited on
Commit
2a6735f
1 Parent(s): 411615f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -41,7 +41,9 @@ def translate_text(text, source_lang="en", target_lang="hi"):
41
 
42
  def handle_request(audio_base64, source_lang, target_lang):
43
  """Handle audio translation request."""
44
- audio_file_path = "temp_audio.wav"
 
 
45
  # Decode the base64 audio
46
  with open(audio_file_path, "wb") as audio_file:
47
  audio_file.write(base64.b64decode(audio_base64))
 
41
 
42
  def handle_request(audio_base64, source_lang, target_lang):
43
  """Handle audio translation request."""
44
+ temp_dir = "/app/temp"
45
+ os.makedirs(temp_dir, exist_ok=True) # Ensure directory exists
46
+ audio_file_path = os.path.join(temp_dir, "temp_audio.wav")
47
  # Decode the base64 audio
48
  with open(audio_file_path, "wb") as audio_file:
49
  audio_file.write(base64.b64decode(audio_base64))