Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
pipe = pipeline("text-to-speech", model="myshell-ai/MeloTTS-English")
|
| 4 |
+
|
| 5 |
+
def text_to_speech(text):
|
| 6 |
+
audio = pipe(text)
|
| 7 |
+
return audio["audio"]
|
| 8 |
+
|
| 9 |
+
title = "Text-to-Speech (MeloTTS)"
|
| 10 |
+
description = "Provide input text, and the model will convert it into speech."
|
| 11 |
+
|
| 12 |
+
interface = gr.Interface(
|
| 13 |
+
fn=text_to_speech,
|
| 14 |
+
inputs=gr.Textbox(label="Input Text", placeholder="Type something..."),
|
| 15 |
+
outputs=gr.Audio(label="Generated Speech"),
|
| 16 |
+
title=title,
|
| 17 |
+
description=description,
|
| 18 |
+
)
|
| 19 |
+
|
| 20 |
+
if __name__ == "__main__":
|
| 21 |
+
interface.launch()
|