Jupyterlab
Jupyterlab
This commit is contained in:
commit
4e8c1b3254
12 files changed
+6769
No files matched your search
+74
@@ -0,0 +1,74 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"#gTTS语音\n",
|
||||
"from gtts import gTTS\n",
|
||||
"#engine = pyttsx3.init('espeak')\n",
|
||||
"tts = gTTS(text=\"军士上前,将英玉兰架起,两个抓着脚踝,两个托住肩头,一起用力,英玉兰无奈分开两条大浪腿,露出骚屄,被举下\",lang='zh-cn')\n",
|
||||
"#engine.save_to_file(\"欢迎使用百度语音合成,本次测试为Python接口\",'./test')\n",
|
||||
"tts.save(\"./test.mp3\")\n",
|
||||
"print('ok')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"#百度语音在线\n",
|
||||
"from aip import AipSpeech\n",
|
||||
"\n",
|
||||
"\"\"\" 你的 APPID AK SK \"\"\"\n",
|
||||
"APP_ID = '17553946'\n",
|
||||
"API_KEY = 'i5LBXalkBn2KHTqdifesA1EB'\n",
|
||||
"SECRET_KEY = '1ktP6qDH7nMFHjotRdKpnI13w41Bvk59'\n",
|
||||
"\n",
|
||||
"client = AipSpeech(APP_ID, API_KEY, SECRET_KEY)\n",
|
||||
"\n",
|
||||
"result = client.synthesis('军士上前,将英玉兰架起,两个抓着脚踝,两个托住肩头,一起用力,英玉兰无奈分开两条大浪腿,露出骚屄,被举下。', 'zh', 5, {\n",
|
||||
" 'vol': 5,'per': 4,\n",
|
||||
"})\n",
|
||||
"\n",
|
||||
"# 识别正确返回语音二进制 错误则返回dict 参照下面错误码\n",
|
||||
"if not isinstance(result, dict):\n",
|
||||
" with open('./test3.mp3', 'wb') as f:\n",
|
||||
" f.write(result)\n",
|
||||
"else:print(result)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.8.5"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 4
|
||||
}
|
||||
Reference in new issue
Block a user