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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -2
app.py CHANGED
@@ -12,6 +12,13 @@ if HF_TOKEN is None:
12
  # クライアント設定
13
  client = Client("Plachta/Seed-VC", hf_token=HF_TOKEN)
14
 
 
 
 
 
 
 
 
15
  def process_audio(
16
  source,
17
  target,
@@ -34,8 +41,8 @@ def process_audio(
34
 
35
  # API呼び出し
36
  result = client.predict(
37
- source=handle_file(source),
38
- target=handle_file(target),
39
  diffusion_steps=diffusion_steps,
40
  length_adjust=length_adjust,
41
  inference_cfg_rate=inference_cfg_rate,
 
12
  # クライアント設定
13
  client = Client("Plachta/Seed-VC", hf_token=HF_TOKEN)
14
 
15
+ # handle_file関数をトークン認証付きに拡張
16
+ def handle_file_with_auth(file_path: str) -> dict:
17
+ headers = {"Authorization": f"Bearer {HF_TOKEN}"}
18
+ # ファイルパスをログ出力
19
+ print(f"Handling file with authentication: {file_path}")
20
+ return {"name": os.path.basename(file_path), "data": file_path, "headers": headers}
21
+
22
  def process_audio(
23
  source,
24
  target,
 
41
 
42
  # API呼び出し
43
  result = client.predict(
44
+ source=handle_file_with_auth(source),
45
+ target=handle_file_with_auth(target),
46
  diffusion_steps=diffusion_steps,
47
  length_adjust=length_adjust,
48
  inference_cfg_rate=inference_cfg_rate,