Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -218,15 +218,15 @@ def function(Textbox, Textbox2, Textbox3, Dropdown):
|
|
218 |
)
|
219 |
output = output["audio_out"]
|
220 |
audio_data = base64.b64decode(output)
|
221 |
-
return audio_data
|
222 |
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
|
228 |
-
#
|
229 |
-
|
230 |
except Exception as e:
|
231 |
print(traceback.format_exc())
|
232 |
return "Please Wait!"
|
@@ -242,9 +242,9 @@ inputs = [
|
|
242 |
]
|
243 |
|
244 |
# outputs = gr.outputs.Image(type="numpy")
|
245 |
-
outputs = gr.outputs.Audio(type="filepath")
|
246 |
|
247 |
-
iface = gr.Interface(fn=function, inputs=inputs, outputs=
|
248 |
|
249 |
iface.launch()
|
250 |
|
|
|
218 |
)
|
219 |
output = output["audio_out"]
|
220 |
audio_data = base64.b64decode(output)
|
221 |
+
# return audio_data
|
222 |
|
223 |
+
Save the audio to an MP3 file
|
224 |
+
mp3_path = "output.mp3"
|
225 |
+
with open(mp3_path, "wb") as f:
|
226 |
+
f.write(audio_data)
|
227 |
|
228 |
+
# Return the path to the MP3 file
|
229 |
+
return mp3_path
|
230 |
except Exception as e:
|
231 |
print(traceback.format_exc())
|
232 |
return "Please Wait!"
|
|
|
242 |
]
|
243 |
|
244 |
# outputs = gr.outputs.Image(type="numpy")
|
245 |
+
# outputs = gr.outputs.Audio(type="filepath")
|
246 |
|
247 |
+
iface = gr.Interface(fn=function, inputs=inputs, outputs="text")
|
248 |
|
249 |
iface.launch()
|
250 |
|