https://github.com/yetone/openai-translator/releases/tag/v0.0.13,下載並解壓縮
打開擴充功能選項,並載入為封裝項目,就可以加入openAI translation的擴充功能了
到https://platform.openai.com/account/api-keys拿到API Key就可以使用翻譯功能了
chatGPT 整合到 Line
https://mrmad.com.tw/chatgpt-line-robot-creation-teaching
Line --> webhook --> chatgpt
Line <-- webhook <-- chatgpt
Line: https://developers.line.biz/console/
申請ChatGPt API key(免費的只有18美元的額度): https://platform.openai.com/account/api-keys
到github並fork專案: https://github.com/memochou1993/gpt-ai-assistant
設定安全性
https://vercel.com/
This user account is blocked. Contact registration@vercel.com for more information.
https://stackoverflow.com/questions/71913088/this-user-account-is-blocked-contact-registrationvercel-com
到https://github.com/apps/vercel下載,並選擇chatGPT Assistant
openAI key(OPENAI_API_KEY)
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
line key(LINE_CHANNEL_ACCESS_TOKEN)
N9NxsKghDbgLzSnnVWEamfjzp3g7VCGO6IppoIEn7szrfBYofAKP7PSQQzwGYlNmjgqDJ9qEvL97TeoM7oeCwFOH/Q5h6CbwR9Ia6+FSnxoT/Yi4KvFl7TdY/YbKRJXn8CbxabrMZCaMWOEK3NiFBQdB04t89/1O/w1cDnyilFU=
line secret(LINE_CHANNEL_SECRET)
4c5605af677c1bb83e31b2a82caca88f
https://gpt-ai-assistant-fy8pe5u4v-s110910541-nquedutw.vercel.app
https://github.com/tomchang25/whisper-auto-transcribe
可以產生.srt檔,就可以自動產生字幕
下載 miniconda 並建立python 3.10的虛擬環境
anaconda basic command
conda create -n 指定虛擬環境名稱 python=指定版本號碼(不指定會妝最新的)conda env listactivate 指定虛擬環境deactivate$ wget https://repo.anaconda.com/miniconda/Miniconda3-py310_23.1.0-1-Linux-x86_64.sh
$ bash Miniconda3-py310_23.1.0-1-Linux-x86_64.sh # yes, enter, yes
$ /root/miniconda3/bin/conda config --set auto_activate_base false
vim .bashrc # = ~/.bashrc
bash 在每次啟動時都會載入 .bashrc 檔案的內容,編輯它可以用以儲存並載入終端配置和環境變數
# .bashrc
# User specific aliases and functions
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
# Source global definitions
if [ -f /etc/bashrc ]; then
chmod 777 /etc/bashrc
/etc/bashrc
fi
export PATH=$PATH:/root/miniconda3/bin
conda 設定環境
$ source .bashrc
$ conda init
$ conda create -n mypython3.10 python=3.10
$ bash
建立環境並下載whisper
$ conda activate mypython3.10
$ sudo yum install git
$ git clone https://github.com/tomchang25/whisper-auto-transcribe.git
$ cd whisper-auto-transcribe
$ pip install -r requirements.txt
$ pip install git+https://github.com/openai/whisper.git # take a long time...
$ pip install gradio
下載影片輔助套件
$ sudo yum install ffmpeg ffmpeg-devel
$ pip install spleeter # take a long time
$ pip install pysubs2
翻譯
$ python cli.py -h # test
$ python cli.py /home/user/work/test.mp4 --output /home/user/work/test.srt -lang ja --task translate --model small # 其他語言 to 日文
$ python cli.py /home/user/work/test.mp4 --output /home/user/work/test.srt -lang zh --task translate --model small # 其他語言 to 中文
$ python cli.py /home/user/work/test.mp4 --output /home/user/work/test.srt -lang zh --model small # 中文 to 中文
可以使用vlc撥放影片
$ sudo yum install epel-release
$ sudo yum install https://download1.rpmfusion.org/free/el/rpmfusion-free-release-7.noarch.rpm
$ sudo yum install vlc
也可以使用腳本產生字幕: https://github.com/smallko/test-whisper (參考影片)
在gen.py裡面的Data_File修改mp4檔案,就可以產生字幕
gen_sub.py是直接改裡面的網址,然後再改標題,就可以產生字幕
gen_sub_toEnglish 一樣是改裡面網址,然後把裡面的語言產生英文字幕
會生成.srt檔(文字檔)
default .bashrc
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# User specific aliases and functions