Spaces:
Sleeping
Sleeping
Download infer/lib/csvutil.py from Transduce/RVC_HFv2: direct link, hf CLI and curl.
- Browser
- Download file 1.26 kB
-
https://huggingface.co/spaces/Transduce/RVC_HFv2/resolve/main/infer/lib/csvutil.py
- Command line
-
hf download hf://spaces/Transduce/RVC_HFv2/infer/lib/csvutil.py
-
curl -L -o csvutil.py https://huggingface.co/spaces/Transduce/RVC_HFv2/resolve/main/infer/lib/csvutil.py
1.26 kB
| import numpy as np | |
| # import praatio | |
| # import praatio.praat_scripts | |
| import os | |
| import sys | |
| import random | |
| import csv | |
| # praatEXE = join('.',os.path.abspath(os.getcwd()) + r"\Praat.exe") | |
| def CSVutil(file, rw, type, *args): | |
| if type == "formanting": | |
| if rw == "r": | |
| with open(file) as fileCSVread: | |
| csv_reader = list(csv.reader(fileCSVread)) | |
| return ( | |
| (csv_reader[0][0], csv_reader[0][1], csv_reader[0][2]) | |
| if csv_reader is not None | |
| else (lambda: exec('raise ValueError("No data")'))() | |
| ) | |
| else: | |
| if args: | |
| doformnt = args[0] | |
| else: | |
| doformnt = False | |
| qfr = args[1] if len(args) > 1 else 1.0 | |
| tmb = args[2] if len(args) > 2 else 1.0 | |
| with open(file, rw, newline="") as fileCSVwrite: | |
| csv_writer = csv.writer(fileCSVwrite, delimiter=",") | |
| csv_writer.writerow([doformnt, qfr, tmb]) | |
| elif type == "stop": | |
| stop = args[0] if args else False | |
| with open(file, rw, newline="") as fileCSVwrite: | |
| csv_writer = csv.writer(fileCSVwrite, delimiter=",") | |
| csv_writer.writerow([stop]) | |