Spaces:
Runtime error
Runtime error
Delete app.py
Browse files
app.py
DELETED
|
@@ -1,24 +0,0 @@
|
|
| 1 |
-
from transformers import pipeline
|
| 2 |
-
import gradio as gr
|
| 3 |
-
|
| 4 |
-
# 从 Hugging Face Hub 加载 Index-TTS 模型
|
| 5 |
-
tts = pipeline("text-to-speech",
|
| 6 |
-
model="IndexTeam/IndexTTS-1.5",
|
| 7 |
-
device_map="auto") # 自动检测 GPU/CPU
|
| 8 |
-
|
| 9 |
-
def synthesize(text, reference_audio):
|
| 10 |
-
# 合成语音(需提前上传参考音频至 Space)
|
| 11 |
-
output = tts(text, voice=reference_audio)
|
| 12 |
-
return output["audio"]
|
| 13 |
-
|
| 14 |
-
# 创建 Gradio 交互界面
|
| 15 |
-
iface = gr.Interface(
|
| 16 |
-
fn=synthesize,
|
| 17 |
-
inputs=[
|
| 18 |
-
gr.Textbox(label="输入文本", placeholder="例如:欢迎使用AI语音合成"),
|
| 19 |
-
gr.Audio(source="upload", type="filepath", label="参考音频(10秒内)")
|
| 20 |
-
],
|
| 21 |
-
outputs=gr.Audio(label="合成音频", type="numpy"),
|
| 22 |
-
title="Index-TTS 语音合成服务"
|
| 23 |
-
)
|
| 24 |
-
iface.launch(server_port=7860, server_name="0.0.0.0")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|