GPTfree api commited on
Commit
d0e5c3a
·
verified ·
1 Parent(s): bae29a7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -2
app.py CHANGED
@@ -23,6 +23,15 @@ def process_audio(
23
  pitch_shift=0
24
  ):
25
  try:
 
 
 
 
 
 
 
 
 
26
  # API呼び出し
27
  result = client.predict(
28
  source=handle_file(source),
@@ -35,9 +44,24 @@ def process_audio(
35
  pitch_shift=pitch_shift,
36
  api_name="/predict"
37
  )
38
- return result
 
 
 
 
 
39
  except Exception as e:
40
- return str(e), None # エラー時にはエラーメッセージを返す
 
 
 
 
 
 
 
 
 
 
41
 
42
  # Gradioインターフェース作成
43
  with gr.Blocks() as demo:
 
23
  pitch_shift=0
24
  ):
25
  try:
26
+ # ファイルパスをログ出力
27
+ print(f"Source file: {source}")
28
+ print(f"Target file: {target}")
29
+
30
+ # APIリクエスト時のパラメータをログ出力
31
+ print(f"Parameters: diffusion_steps={diffusion_steps}, length_adjust={length_adjust}, "
32
+ f"inference_cfg_rate={inference_cfg_rate}, f0_condition={f0_condition}, "
33
+ f"auto_f0_adjust={auto_f0_adjust}, pitch_shift={pitch_shift}")
34
+
35
  # API呼び出し
36
  result = client.predict(
37
  source=handle_file(source),
 
44
  pitch_shift=pitch_shift,
45
  api_name="/predict"
46
  )
47
+
48
+ # 結果のログ出力
49
+ print(f"Result: {result}")
50
+
51
+ return result # 成功時は結果をそのまま返す
52
+
53
  except Exception as e:
54
+ # エラー発生時に詳細をログ出力
55
+ error_message = f"An error occurred: {str(e)}"
56
+ print(error_message)
57
+
58
+ # ファイルパスやエラー内容を返す
59
+ return (f"Error: {error_message}\n"
60
+ f"Source file: {source}\n"
61
+ f"Target file: {target}\n"
62
+ f"Parameters: diffusion_steps={diffusion_steps}, length_adjust={length_adjust}, "
63
+ f"inference_cfg_rate={inference_cfg_rate}, f0_condition={f0_condition}, "
64
+ f"auto_f0_adjust={auto_f0_adjust}, pitch_shift={pitch_shift}"), None
65
 
66
  # Gradioインターフェース作成
67
  with gr.Blocks() as demo: