Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,12 +1,11 @@
|
|
1 |
import gradio as gr
|
2 |
import torch
|
|
|
3 |
|
4 |
# 假设模型是一个声音合成模型
|
5 |
def synthesize_speech(text):
|
6 |
-
# 加载模型并映射到 CPU
|
7 |
model = torch.load("mg_e8_s112.pth", map_location=torch.device('cpu'))
|
8 |
model.eval()
|
9 |
-
# 假设你的模型有一个名为 synthesize 的方法
|
10 |
audio_output = model.synthesize(text)
|
11 |
return audio_output
|
12 |
|
@@ -14,4 +13,4 @@ gr.Interface(
|
|
14 |
fn=synthesize_speech,
|
15 |
inputs="text",
|
16 |
outputs="audio"
|
17 |
-
).launch()
|
|
|
1 |
import gradio as gr
|
2 |
import torch
|
3 |
+
import utils # 确保导入utils模块
|
4 |
|
5 |
# 假设模型是一个声音合成模型
|
6 |
def synthesize_speech(text):
|
|
|
7 |
model = torch.load("mg_e8_s112.pth", map_location=torch.device('cpu'))
|
8 |
model.eval()
|
|
|
9 |
audio_output = model.synthesize(text)
|
10 |
return audio_output
|
11 |
|
|
|
13 |
fn=synthesize_speech,
|
14 |
inputs="text",
|
15 |
outputs="audio"
|
16 |
+
).launch(share=True)
|