Update core.py
Browse files
core.py
CHANGED
|
@@ -28,7 +28,7 @@ locales = list({voice["Locale"] for voice in voices_data})
|
|
| 28 |
|
| 29 |
|
| 30 |
# Infer
|
| 31 |
-
@spaces.GPU
|
| 32 |
def run_infer_script(
|
| 33 |
f0up_key,
|
| 34 |
filter_radius,
|
|
@@ -80,6 +80,7 @@ def run_infer_script(
|
|
| 80 |
|
| 81 |
|
| 82 |
# Batch infer
|
|
|
|
| 83 |
def run_batch_infer_script(
|
| 84 |
f0up_key,
|
| 85 |
filter_radius,
|
|
@@ -147,6 +148,7 @@ def run_batch_infer_script(
|
|
| 147 |
|
| 148 |
|
| 149 |
# TTS
|
|
|
|
| 150 |
def run_tts_script(
|
| 151 |
tts_text,
|
| 152 |
tts_voice,
|
|
@@ -227,20 +229,6 @@ def run_prerequisites_script(pretraineds_v1, pretraineds_v2, models, exe):
|
|
| 227 |
prequisites_download_pipeline(pretraineds_v1, pretraineds_v2, models, exe)
|
| 228 |
return "Prerequisites installed successfully."
|
| 229 |
|
| 230 |
-
|
| 231 |
-
# API
|
| 232 |
-
def run_api_script(ip, port):
|
| 233 |
-
command = [
|
| 234 |
-
"env/Scripts/uvicorn.exe" if os.name == "nt" else "uvicorn",
|
| 235 |
-
"api:app",
|
| 236 |
-
"--host",
|
| 237 |
-
ip,
|
| 238 |
-
"--port",
|
| 239 |
-
port,
|
| 240 |
-
]
|
| 241 |
-
subprocess.run(command)
|
| 242 |
-
|
| 243 |
-
|
| 244 |
# Parse arguments
|
| 245 |
def parse_arguments():
|
| 246 |
parser = argparse.ArgumentParser(
|
|
@@ -694,13 +682,6 @@ def parse_arguments():
|
|
| 694 |
help="Download executables",
|
| 695 |
)
|
| 696 |
|
| 697 |
-
# Parser for 'api' mode
|
| 698 |
-
api_parser = subparsers.add_parser("api", help="Run the API")
|
| 699 |
-
api_parser.add_argument(
|
| 700 |
-
"--host", type=str, help="Host address", default="127.0.0.1"
|
| 701 |
-
)
|
| 702 |
-
api_parser.add_argument("--port", type=str, help="Port", default="8000")
|
| 703 |
-
|
| 704 |
return parser.parse_args()
|
| 705 |
|
| 706 |
|
|
@@ -792,11 +773,6 @@ def main():
|
|
| 792 |
str(args.models),
|
| 793 |
str(args.exe),
|
| 794 |
)
|
| 795 |
-
elif args.mode == "api":
|
| 796 |
-
run_api_script(
|
| 797 |
-
str(args.host),
|
| 798 |
-
str(args.port),
|
| 799 |
-
)
|
| 800 |
except Exception as error:
|
| 801 |
print(f"Error: {error}")
|
| 802 |
|
|
|
|
| 28 |
|
| 29 |
|
| 30 |
# Infer
|
| 31 |
+
@spaces.GPU
|
| 32 |
def run_infer_script(
|
| 33 |
f0up_key,
|
| 34 |
filter_radius,
|
|
|
|
| 80 |
|
| 81 |
|
| 82 |
# Batch infer
|
| 83 |
+
@spaces.GPU
|
| 84 |
def run_batch_infer_script(
|
| 85 |
f0up_key,
|
| 86 |
filter_radius,
|
|
|
|
| 148 |
|
| 149 |
|
| 150 |
# TTS
|
| 151 |
+
@spaces.GPU
|
| 152 |
def run_tts_script(
|
| 153 |
tts_text,
|
| 154 |
tts_voice,
|
|
|
|
| 229 |
prequisites_download_pipeline(pretraineds_v1, pretraineds_v2, models, exe)
|
| 230 |
return "Prerequisites installed successfully."
|
| 231 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 232 |
# Parse arguments
|
| 233 |
def parse_arguments():
|
| 234 |
parser = argparse.ArgumentParser(
|
|
|
|
| 682 |
help="Download executables",
|
| 683 |
)
|
| 684 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 685 |
return parser.parse_args()
|
| 686 |
|
| 687 |
|
|
|
|
| 773 |
str(args.models),
|
| 774 |
str(args.exe),
|
| 775 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 776 |
except Exception as error:
|
| 777 |
print(f"Error: {error}")
|
| 778 |
|