next-playground commited on
Commit
c2f16dd
1 Parent(s): 5b537c2

Update flask_api_full_song.py

Browse files
Files changed (1) hide show
  1. flask_api_full_song.py +32 -2
flask_api_full_song.py CHANGED
@@ -6,6 +6,9 @@ from flask import Flask, request, send_file
6
 
7
  from inference import infer_tool, slicer
8
 
 
 
 
9
  app = Flask(__name__)
10
 
11
 
@@ -49,7 +52,34 @@ def wav2wav():
49
 
50
 
51
  if __name__ == '__main__':
52
- model_name = "logs/44k/G_60000.pth" # 模型地址
53
- config_name = "configs/config.json" # config地址
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  svc_model = infer_tool.Svc(model_name, config_name)
55
  app.run(port=1145, host="0.0.0.0", debug=False, threaded=False)
 
6
 
7
  from inference import infer_tool, slicer
8
 
9
+ import requests
10
+ import os
11
+
12
  app = Flask(__name__)
13
 
14
 
 
52
 
53
 
54
  if __name__ == '__main__':
55
+ secret_id = os.getenv('SECRET_ID')
56
+ secret_key = os.getenv('SECRET_KEY')
57
+ region = 'na-siliconvalley'
58
+ bucket_name = 'xiaohei-cat-ai-1304646510'
59
+ cos_path = '你要下载的文件在COS中的路径'
60
+
61
+ config = CosConfig(Region=region, SecretId=secret_id, SecretKey=secret_key)
62
+ client = CosS3Client(config)
63
+
64
+ response1 = client.get_object(
65
+ Bucket=bucket_name,
66
+ Key="models/So-VITS-SVC/Koxia-Full/G_full.pth"
67
+ )
68
+
69
+ with open("/tmp/G_full.pth", 'wb') as local_file:
70
+ for chunk in response1['Body'].iter_chunks():
71
+ local_file.write(chunk)
72
+
73
+ response2 = client.get_object(
74
+ Bucket=bucket_name,
75
+ Key="models/So-VITS-SVC/Koxia-Full/config.json"
76
+ )
77
+
78
+ with open("/tmp/config.json", 'wb') as local_file:
79
+ for chunk in response2['Body'].iter_chunks():
80
+ local_file.write(chunk)
81
+
82
+ model_name = "/tmp/G_full.pth" # 模型地址
83
+ config_name = "/tmp/config.json" # config地址
84
  svc_model = infer_tool.Svc(model_name, config_name)
85
  app.run(port=1145, host="0.0.0.0", debug=False, threaded=False)