Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -14,19 +14,18 @@ def text_to_speech(text):
|
|
14 |
# Check if the file is saved correctly
|
15 |
if os.path.exists(output_path):
|
16 |
print(f"Audio saved to {output_path}")
|
|
|
17 |
else:
|
18 |
print("Failed to save audio.")
|
19 |
-
|
20 |
-
# Return the file path
|
21 |
-
return output_path
|
22 |
except Exception as e:
|
23 |
print(f"Error: {e}")
|
24 |
-
return
|
25 |
|
26 |
# Create Gradio interface
|
27 |
iface = gr.Interface(fn=text_to_speech,
|
28 |
inputs="text",
|
29 |
-
outputs=gr.Audio(type="filepath"), #
|
30 |
title="Text to Speech",
|
31 |
description="Enter text, and the system will read it aloud.")
|
32 |
iface.launch()
|
|
|
14 |
# Check if the file is saved correctly
|
15 |
if os.path.exists(output_path):
|
16 |
print(f"Audio saved to {output_path}")
|
17 |
+
return output_path # Return the file path directly
|
18 |
else:
|
19 |
print("Failed to save audio.")
|
20 |
+
return None
|
|
|
|
|
21 |
except Exception as e:
|
22 |
print(f"Error: {e}")
|
23 |
+
return None
|
24 |
|
25 |
# Create Gradio interface
|
26 |
iface = gr.Interface(fn=text_to_speech,
|
27 |
inputs="text",
|
28 |
+
outputs=gr.Audio(type="filepath"), # Make sure 'filepath' is used
|
29 |
title="Text to Speech",
|
30 |
description="Enter text, and the system will read it aloud.")
|
31 |
iface.launch()
|