Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
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(
|
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 |
|