File size: 403 Bytes
4346cc1
 
dc90c5c
6ce5498
d68b782
 
b032438
d68b782
 
 
6ce5498
d68b782
 
 
 
dc90c5c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import gradio as gr
import torch
import utils  # 确保导入utils模块

# 假设模型是一个声音合成模型
def synthesize_speech(text):
    model = torch.load("mg_e8_s112.pth", map_location=torch.device('cpu'))
    model.eval()
    audio_output = model.synthesize(text)
    return audio_output

gr.Interface(
    fn=synthesize_speech,
    inputs="text",
    outputs="audio"
).launch(share=True)