This repository was archived by the owner on Dec 24, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +52
-11
lines changed
Expand file tree Collapse file tree 4 files changed +52
-11
lines changed Original file line number Diff line number Diff line change 1+ name : CI
2+
3+ on :
4+ push :
5+ branches : [main]
6+
7+ jobs :
8+ build :
9+ runs-on : ubuntu-latest
10+
11+ steps :
12+ - uses : privapps/docker-ttskit@main
13+ with :
14+ text : ' 1'
15+ content : ' ./out.wav'
16+ - run : ls -l
Original file line number Diff line number Diff line change 11FROM privapps/ttskit:0.1.6_base
22
3+ WORKDIR /workspace
4+
35COPY run.sh /
46COPY run.py /
5- RUN mkdir -p $WORKDIR ; chmod a+rwx $WORKDIR run.sh
67
7- ENTRYPOINT ["/run.sh" ]
8+ RUN mkdir -p $WORKDIR ; chmod a+rwx $WORKDIR /run.sh
9+
10+ ENTRYPOINT ["python" ,"/run.py" ]
Original file line number Diff line number Diff line change 1+ # action.yml
2+ name : ' TTSKIT'
3+ description : ' Generate Chinese Mandarin voice from text'
4+ inputs :
5+ text : # id of input
6+ description : ' What text?'
7+ required : true
8+ default : ' World'
9+ voice : # id of input
10+ description : ' What Voice'
11+ required : false
12+ default : ' 24'
13+ content : # id of output
14+ required : false
15+ description : ' path that wave binary save to'
16+ default : ' ./__out__.wav'
17+ runs :
18+ using : ' docker'
19+ image : ' Dockerfile'
20+ args :
21+ - ${{ inputs.text }}
22+ - ${{ inputs.voice }}
Original file line number Diff line number Diff line change 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
8+ import ttskit , sys , os
9+
10+ text = os .environ ["INPUT_TEXT" ]
11+ voice = os .environ ["INPUT_VOICE" ]
12+ wave_path = os .environ ["INPUT_CONTENT" ]
913
1014def getVoice (default_val = 24 ) -> int :
1115 try :
12- with open ('/workspace/__voice__.txt' , 'rt' ) as f :
13- lines = f .readlines ()
14- num = int ('' .join (lines ))
16+ num = int (voice )
1517 return num if num > 0 and num <= 30 else default_val
1618 return num
1719 except Exception :
1820 return default_val
1921
20- with open ('/workspace/__input__.txt' , 'rt' ) as f :
21- lines = f .readlines ()
22- wav = ttskit .tts (' ' .join (lines ),audio = str (getVoice ()))
22+
23+ wav = ttskit .tts (text ,audio = str (getVoice ()))
2324
24- file_name = '/workspace/__out__.wav'
25- with open (file_name , "wb" ) as f :
25+ with open (wave_path , "wb" ) as f :
2626 f .write (wav )
You can’t perform that action at this time.
0 commit comments