Skip to content
This repository was archived by the owner on Dec 24, 2021. It is now read-only.

Commit 3a43fb4

Browse files
committed
make it as github action
1 parent 0531928 commit 3a43fb4

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

README.md

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
## What
2-
这是拥有最基本 [ttskit](https://github.com/KuangDD/ttskit)功能的 docker image
2+
这是拥有最基本 [ttskit](https://github.com/KuangDD/ttskit)功能的,联合 GitHub Action 的插件
33

44
## Why
5-
ttskit语音生成的效果不错,但是有很多第三方库,还有一些训练过的数据。如果是一台新机器,需要很长时间下载,设置。这里把所有打包好了,可以拿起来马上用
5+
ttskit语音生成的效果不错,但是有很多第三方库,还有一些训练过的数据。如果是一台新机器,需要很长时间下载,设置。我想改造一下,能在 github workflow / action 上用
66

77
## Usage
88
```
9-
echo "需要转换的文字" > __input__.txt
10-
echo 17 > __voice__.txt
11-
docker run --rm -v .:/workspace privapps/ttskit
12-
13-
# out put should at __out__.wav
9+
jobs:
10+
job:
11+
steps:
12+
- uses: privapps/docker-ttskit@action
13+
with:
14+
text: '需要转换的文字'
15+
voice: '13'
16+
content: '输出 wave 的路径'
1417
```
15-
其中 `__voice__.txt` 是可选项,里面是语音的ID,具体一共有30个不同的语音
18+
Voice 具体一共有30个不同的语音
1619
```
1720
{
1821
1: 'Aibao', 2: 'Aicheng', 3: 'Aida', 4: 'Aijia', 5: 'Aijing',
@@ -23,4 +26,4 @@ docker run --rm -v .:/workspace privapps/ttskit
2326
26: 'cctvfb', 27: 'cctvma', 28: 'cctvmb', 29: 'cctvmc', 30: 'cctvmd'
2427
}
2528
```
26-
部分演示可以在[这里找到小样](https://github.com/KuangDD/zhrtvc/tree/master/data/files/examples)
29+
部分可以在[这里找到小样](https://github.com/KuangDD/zhrtvc/tree/master/data/files/examples)

action.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,3 @@ inputs:
1717
runs:
1818
using: 'docker'
1919
image: 'Dockerfile'
20-
args:
21-
- ${{ inputs.text }}
22-
- ${{ inputs.voice }}

run.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
# File: /workspace/__voice__.txt is optional with number only, which indicate which voice to use
66
# File: /workspace/__out__.wav is the one will be generated
77
##############################################
8-
import ttskit, sys, os
8+
import ttskit, sys, os, warnings
9+
10+
warnings.filterwarnings('ignore')
911

1012
text = os.environ["INPUT_TEXT"]
1113
voice = os.environ["INPUT_VOICE"]
@@ -15,12 +17,10 @@ def getVoice(default_val = 24) -> int:
1517
try:
1618
num = int(voice)
1719
return num if num > 0 and num <= 30 else default_val
18-
return num
1920
except Exception:
2021
return default_val
21-
2222

2323
wav=ttskit.tts(text,audio=str(getVoice()))
2424

2525
with open(wave_path, "wb") as f:
26-
f.write(wav)
26+
f.write(wav)

0 commit comments

Comments
 (0)