Update voice_create.py
Browse files- voice_create.py +4 -0
voice_create.py
CHANGED
|
@@ -6,6 +6,9 @@ import os
|
|
| 6 |
import requests
|
| 7 |
import re
|
| 8 |
|
|
|
|
|
|
|
|
|
|
| 9 |
def text_to_speech(input_file):
|
| 10 |
# APIキーを直接コードに埋め込む(実際の運用では推奨されません)
|
| 11 |
api_key = 'AIzaSyAEzK5_n6zKTimD9yoXS-C8O0xN_4LaVBQ' # ここを実際のAPIキーに置き換えてください
|
|
@@ -31,6 +34,7 @@ def text_to_speech(input_file):
|
|
| 31 |
continue # A:またはB:で始まらない行は無視
|
| 32 |
|
| 33 |
text = parts[i + 1].strip()
|
|
|
|
| 34 |
print("テキスト",text)
|
| 35 |
# テキスト内の改行を1sの間に変換
|
| 36 |
text = text.replace("\n", '<break time="1s"/>')
|
|
|
|
| 6 |
import requests
|
| 7 |
import re
|
| 8 |
|
| 9 |
+
def remove_quotes(text):
|
| 10 |
+
# ダブルクォートを空文字に置き換える
|
| 11 |
+
return text.replace('"', '')
|
| 12 |
def text_to_speech(input_file):
|
| 13 |
# APIキーを直接コードに埋め込む(実際の運用では推奨されません)
|
| 14 |
api_key = 'AIzaSyAEzK5_n6zKTimD9yoXS-C8O0xN_4LaVBQ' # ここを実際のAPIキーに置き換えてください
|
|
|
|
| 34 |
continue # A:またはB:で始まらない行は無視
|
| 35 |
|
| 36 |
text = parts[i + 1].strip()
|
| 37 |
+
text = remove_quotes(text)
|
| 38 |
print("テキスト",text)
|
| 39 |
# テキスト内の改行を1sの間に変換
|
| 40 |
text = text.replace("\n", '<break time="1s"/>')
|