spdraptor commited on
Commit
79edfd3
·
verified ·
1 Parent(s): 2791ca3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -11
app.py CHANGED
@@ -83,27 +83,27 @@ def generate_audio(prompt, seconds_total=30, steps=100, cfg_scale=7):
83
  print("Audio normalized and converted.")
84
 
85
  # # Generate a unique filename for the output
86
- # unique_filename = f"output_{uuid.uuid4().hex}.wav"
87
- # print(f"Saving audio to file: {unique_filename}")
88
 
89
  # # Save to file
90
- # torchaudio.save(unique_filename, output, sample_rate)
91
- # print(f"Audio saved: {unique_filename}")
92
 
93
  # compressed_filename = compress_file(unique_filename)
94
  # return compressed_filename
95
 
96
  # # Return the path to the generated audio file
97
- # return unique_filename
98
 
99
  # Convert audio tensor to bytes
100
- byte_io = io.BytesIO()
101
- torchaudio.save(byte_io, output, sample_rate, format="wav")
102
- byte_io.seek(0)
103
- audio_bytes = byte_io.read()
104
- print("Audio converted to bytes.")
105
 
106
- return audio_bytes
107
 
108
 
109
  DESCRIPTION = "Welcome to Raptor APIs"
 
83
  print("Audio normalized and converted.")
84
 
85
  # # Generate a unique filename for the output
86
+ unique_filename = f"output_{uuid.uuid4().hex}.wav"
87
+ print(f"Saving audio to file: {unique_filename}")
88
 
89
  # # Save to file
90
+ torchaudio.save(unique_filename, output, sample_rate)
91
+ print(f"Audio saved: {unique_filename}")
92
 
93
  # compressed_filename = compress_file(unique_filename)
94
  # return compressed_filename
95
 
96
  # # Return the path to the generated audio file
97
+ return unique_filename
98
 
99
  # Convert audio tensor to bytes
100
+ # byte_io = io.BytesIO()
101
+ # torchaudio.save(byte_io, output, sample_rate, format="wav")
102
+ # byte_io.seek(0)
103
+ # audio_bytes = byte_io.read()
104
+ # print("Audio converted to bytes.")
105
 
106
+ # return audio_bytes
107
 
108
 
109
  DESCRIPTION = "Welcome to Raptor APIs"