Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -27,21 +27,17 @@ def tts_api():
|
|
| 27 |
model_name, speed, tts_text, tts_voice, f0_key_up, f0_method, index_rate, protect0
|
| 28 |
)
|
| 29 |
|
| 30 |
-
#
|
| 31 |
-
# tts_outputやedge_tts_outputがタプルで返っていないか確認し、正しいファイルパスを取得
|
| 32 |
if isinstance(tts_output, tuple):
|
| 33 |
tts_output = tts_output[0] # タプルの最初の要素を取得
|
| 34 |
|
| 35 |
-
|
| 36 |
-
edge_tts_output = edge_tts_output[0] # タプルの最初の要素を取得
|
| 37 |
-
|
| 38 |
-
# 生成された音声ファイルを返す
|
| 39 |
if tts_output and os.path.exists(tts_output):
|
| 40 |
return send_file(tts_output, as_attachment=True)
|
| 41 |
|
| 42 |
-
# エッジTTS
|
| 43 |
-
if edge_tts_output and os.path.exists(edge_tts_output):
|
| 44 |
-
|
| 45 |
|
| 46 |
return jsonify({"error": "Failed to generate TTS output"}), 500
|
| 47 |
|
|
|
|
| 27 |
model_name, speed, tts_text, tts_voice, f0_key_up, f0_method, index_rate, protect0
|
| 28 |
)
|
| 29 |
|
| 30 |
+
# 処理後のtts_outputがタプルで返される場合、そのパスを取得
|
|
|
|
| 31 |
if isinstance(tts_output, tuple):
|
| 32 |
tts_output = tts_output[0] # タプルの最初の要素を取得
|
| 33 |
|
| 34 |
+
# 生成されたTTSファイルをクライアントに返す(tts_outputを使用)
|
|
|
|
|
|
|
|
|
|
| 35 |
if tts_output and os.path.exists(tts_output):
|
| 36 |
return send_file(tts_output, as_attachment=True)
|
| 37 |
|
| 38 |
+
# エッジTTS出力を返さないようにする(これは不要)
|
| 39 |
+
# if edge_tts_output and os.path.exists(edge_tts_output):
|
| 40 |
+
# return send_file(edge_tts_output, as_attachment=True)
|
| 41 |
|
| 42 |
return jsonify({"error": "Failed to generate TTS output"}), 500
|
| 43 |
|