Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,22 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
|
4 |
+
# Load the TTS model
|
5 |
+
tts = pipeline("text-to-speech")
|
6 |
+
|
7 |
+
def text_to_speech(text):
|
8 |
+
# Generate speech from text
|
9 |
+
audio = tts(text)
|
10 |
+
return audio["audio"]
|
11 |
+
|
12 |
+
# Create a Gradio interface
|
13 |
+
iface = gr.Interface(
|
14 |
+
fn=text_to_speech,
|
15 |
+
inputs="text",
|
16 |
+
outputs="audio",
|
17 |
+
title="Text to Speech",
|
18 |
+
description="Convert text to speech using Hugging Face Transformers."
|
19 |
+
)
|
20 |
+
|
21 |
+
# Launch the interface
|
22 |
+
iface.launch()
|