Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from gtts import gTTS
|
3 |
+
import os
|
4 |
+
|
5 |
+
def virtual_meditation_class(input_text):
|
6 |
+
# Use text-to-speech to convert the input_text to audio
|
7 |
+
tts = gTTS(input_text)
|
8 |
+
audio_file = "output.mp3"
|
9 |
+
tts.save(audio_file)
|
10 |
+
|
11 |
+
# Play the audio file
|
12 |
+
os.system("mpg321 " + audio_file)
|
13 |
+
|
14 |
+
# Create a Gradio interface with a text input and an audio output
|
15 |
+
gradio_interface = gr.Interface(
|
16 |
+
fn=virtual_meditation_class,
|
17 |
+
inputs=gr.inputs.Textbox(lines=10, label="Enter your guided meditation instructions here"),
|
18 |
+
outputs=gr.outputs.Audio(label="Meditation instructions")
|
19 |
+
)
|
20 |
+
|
21 |
+
# Launch the interface
|
22 |
+
gradio_interface.launch()
|