next-playground commited on
Commit
240ec1d
1 Parent(s): c565b19

Update flask_api_full_song.py

Browse files
Files changed (1) hide show
  1. flask_api_full_song.py +6 -10
flask_api_full_song.py CHANGED
@@ -17,25 +17,21 @@ secret_key = os.getenv('SECRET_KEY')
17
  region = 'na-siliconvalley'
18
  bucket_name = 'xiaohei-cat-ai-1304646510'
19
 
20
- workdir = os.getcwd()
21
- os.chdir("/tmp")
22
-
23
  config = CosConfig(Region=region, SecretId=secret_id, SecretKey=secret_key)
24
  client = CosS3Client(config)
25
 
26
- response1 = client.download_file(
27
  Bucket=bucket_name,
28
- Key="models/So-VITS-SVC/Koxia-Full/G_full.pth",
29
- DestFilePath="/tmp/G_full.pth"
30
  )
 
31
 
32
- response2 = client.download_file(
33
  Bucket=bucket_name,
34
- Key="models/So-VITS-SVC/Koxia-Full/config.json",
35
- DestFilePath="/tmp/config.json"
36
  )
 
37
 
38
- os.chdir(workdir)
39
 
40
  model_name = "/tmp/G_full.pth" # 模型地址
41
  config_name = "/tmp/config.json" # config地址
 
17
  region = 'na-siliconvalley'
18
  bucket_name = 'xiaohei-cat-ai-1304646510'
19
 
 
 
 
20
  config = CosConfig(Region=region, SecretId=secret_id, SecretKey=secret_key)
21
  client = CosS3Client(config)
22
 
23
+ response1 = client.get_object(
24
  Bucket=bucket_name,
25
+ Key="models/So-VITS-SVC/Koxia-Full/G_full.pth"
 
26
  )
27
+ response1['Body'].get_stream_to_file('/tmp/G_full.pth')
28
 
29
+ response2 = client.get_object(
30
  Bucket=bucket_name,
31
+ Key="models/So-VITS-SVC/Koxia-Full/config.json"
 
32
  )
33
+ response2['Body'].get_stream_to_file('/tmp/config.json')
34
 
 
35
 
36
  model_name = "/tmp/G_full.pth" # 模型地址
37
  config_name = "/tmp/config.json" # config地址