yosuke-i commited on
Commit
a77fb3e
·
verified ·
1 Parent(s): e0f694b

Update voice_create.py

Browse files
Files changed (1) hide show
  1. voice_create.py +8 -8
voice_create.py CHANGED
@@ -10,7 +10,7 @@ def remove_quotes(text):
10
  # ダブルクォートを空文字に置き換える
11
  return text.replace('"', '')
12
 
13
- def text_to_speech(input_file):
14
  # APIキーを直接コードに埋め込む(実際の運用では推奨されません)
15
  api_key = 'AIzaSyAEzK5_n6zKTimD9yoXS-C8O0xN_4LaVBQ' # ここを実際のAPIキーに置き換えてください
16
  data = pd.read_csv(input_file)
@@ -60,13 +60,13 @@ def text_to_speech(input_file):
60
  text = text.replace("\n", '<break time="1s"/>')
61
  text = text.replace(".", '.<break time="500ms"/>')
62
 
63
-
64
- # 「,」で時間を空ける
65
- if row["eikenn"] in ["5級","4級","3級","準2級","2級","準1級"]:
66
- text = text.replace(",", '<break time="50ms"/>')
67
- print("タグ処理")
68
- else:
69
- pass
70
 
71
  ssml_parts.append(f'<voice name="{voice_name}"><prosody rate="{row["speed"]}"><p>{text}</p></prosody></voice>')
72
  print(ssml_parts)
 
10
  # ダブルクォートを空文字に置き換える
11
  return text.replace('"', '')
12
 
13
+ def text_to_speech(input_file,selected_option):
14
  # APIキーを直接コードに埋め込む(実際の運用では推奨されません)
15
  api_key = 'AIzaSyAEzK5_n6zKTimD9yoXS-C8O0xN_4LaVBQ' # ここを実際のAPIキーに置き換えてください
16
  data = pd.read_csv(input_file)
 
60
  text = text.replace("\n", '<break time="1s"/>')
61
  text = text.replace(".", '.<break time="500ms"/>')
62
 
63
+ if selected_option == "ブレイクタイム有":
64
+ # 「,」で時間を空ける
65
+ if row["eikenn"] in ["5級","4級","3級","準2級","2級","準1級"]:
66
+ text = text.replace(",", '<break time="50ms"/>')
67
+ print("タグ処理")
68
+ else:
69
+ pass
70
 
71
  ssml_parts.append(f'<voice name="{voice_name}"><prosody rate="{row["speed"]}"><p>{text}</p></prosody></voice>')
72
  print(ssml_parts)