Spaces:
Runtime error
Runtime error
Update flask_api_full_song.py
Browse files- flask_api_full_song.py +32 -29
flask_api_full_song.py
CHANGED
|
@@ -11,6 +11,38 @@ import threading
|
|
| 11 |
from qcloud_cos import CosConfig
|
| 12 |
from qcloud_cos import CosS3Client
|
| 13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
tasks = {}
|
| 15 |
running_threads = 0
|
| 16 |
condition = threading.Condition()
|
|
@@ -105,33 +137,4 @@ def download(filename):
|
|
| 105 |
|
| 106 |
|
| 107 |
if __name__ == '__main__':
|
| 108 |
-
secret_id = os.getenv('SECRET_ID')
|
| 109 |
-
secret_key = os.getenv('SECRET_KEY')
|
| 110 |
-
region = 'na-siliconvalley'
|
| 111 |
-
bucket_name = 'xiaohei-cat-ai-1304646510'
|
| 112 |
-
|
| 113 |
-
config = CosConfig(Region=region, SecretId=secret_id, SecretKey=secret_key)
|
| 114 |
-
client = CosS3Client(config)
|
| 115 |
-
|
| 116 |
-
response1 = client.get_object(
|
| 117 |
-
Bucket=bucket_name,
|
| 118 |
-
Key="models/So-VITS-SVC/Koxia-Full/G_full.pth"
|
| 119 |
-
)
|
| 120 |
-
|
| 121 |
-
with open("/tmp/G_full.pth", 'wb') as local_file:
|
| 122 |
-
for chunk in response1['Body'].iter_chunks():
|
| 123 |
-
local_file.write(chunk)
|
| 124 |
-
|
| 125 |
-
response2 = client.get_object(
|
| 126 |
-
Bucket=bucket_name,
|
| 127 |
-
Key="models/So-VITS-SVC/Koxia-Full/config.json"
|
| 128 |
-
)
|
| 129 |
-
|
| 130 |
-
with open("/tmp/config.json", 'wb') as local_file:
|
| 131 |
-
for chunk in response2['Body'].iter_chunks():
|
| 132 |
-
local_file.write(chunk)
|
| 133 |
-
|
| 134 |
-
model_name = "/tmp/G_full.pth" # 模型地址
|
| 135 |
-
config_name = "/tmp/config.json" # config地址
|
| 136 |
-
svc_model = infer_tool.Svc(model_name, config_name)
|
| 137 |
app.run(port=1145, host="0.0.0.0", debug=False, threaded=False)
|
|
|
|
| 11 |
from qcloud_cos import CosConfig
|
| 12 |
from qcloud_cos import CosS3Client
|
| 13 |
|
| 14 |
+
|
| 15 |
+
secret_id = os.getenv('SECRET_ID')
|
| 16 |
+
secret_key = os.getenv('SECRET_KEY')
|
| 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 |
+
|
| 28 |
+
with open("/tmp/G_full.pth", 'wb') as local_file:
|
| 29 |
+
for chunk in response1['Body'].iter_chunks():
|
| 30 |
+
local_file.write(chunk)
|
| 31 |
+
|
| 32 |
+
response2 = client.get_object(
|
| 33 |
+
Bucket=bucket_name,
|
| 34 |
+
Key="models/So-VITS-SVC/Koxia-Full/config.json"
|
| 35 |
+
)
|
| 36 |
+
|
| 37 |
+
with open("/tmp/config.json", 'wb') as local_file:
|
| 38 |
+
for chunk in response2['Body'].iter_chunks():
|
| 39 |
+
local_file.write(chunk)
|
| 40 |
+
|
| 41 |
+
model_name = "/tmp/G_full.pth" # 模型地址
|
| 42 |
+
config_name = "/tmp/config.json" # config地址
|
| 43 |
+
svc_model = infer_tool.Svc(model_name, config_name)
|
| 44 |
+
|
| 45 |
+
|
| 46 |
tasks = {}
|
| 47 |
running_threads = 0
|
| 48 |
condition = threading.Condition()
|
|
|
|
| 137 |
|
| 138 |
|
| 139 |
if __name__ == '__main__':
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 140 |
app.run(port=1145, host="0.0.0.0", debug=False, threaded=False)
|