Delik commited on
Commit
9946e7a
1 Parent(s): 7180a69

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -13,13 +13,18 @@ except Exception as e:
13
  print(f"Error initializing pipeline: {e}")
14
  pipeline = None
15
 
 
16
  def save_audio(audio):
17
  if pipeline is None:
18
  return "Error: Pipeline not initialized"
19
 
 
 
 
 
20
  # Save the uploaded audio file to a temporary location
21
  with open("temp.wav", "wb") as f:
22
- f.write(audio)
23
 
24
  return "temp.wav"
25
 
 
13
  print(f"Error initializing pipeline: {e}")
14
  pipeline = None
15
 
16
+
17
  def save_audio(audio):
18
  if pipeline is None:
19
  return "Error: Pipeline not initialized"
20
 
21
+ # Read the uploaded audio file as bytes
22
+ with open(audio, "rb") as f:
23
+ audio_data = f.read()
24
+
25
  # Save the uploaded audio file to a temporary location
26
  with open("temp.wav", "wb") as f:
27
+ f.write(audio_data)
28
 
29
  return "temp.wav"
30