Comments (4)
Show me the code/client you are using to make an API request.
from rvc_cli.
its a unity app (below) I'm fairly confident in the framework working for other POST requests i have used... - Also i did experiment with the header and got a different error so i don't think its the header... but not sure. - is there anyway to check if the above JSON works for you?
string url = $"http://127.0.0.1:5000/infer";
using (var postRequest = UnityWebRequest.PostWwwForm(url, "POST"))
{
byte[] bodyRaw = System.Text.Encoding.UTF8.GetBytes(json);
postRequest.uploadHandler = (UploadHandler)new UploadHandlerRaw(bodyRaw);
postRequest.SetRequestHeader("Content-Type", "application/json");
yield return postRequest.SendWebRequest();
if (postRequest.result != UnityWebRequest.Result.Success)
{
Debug.Log(" POST REQUEST FAILED: " + postRequest.error);
}
else { Debug.Log("SUCCESS"); }
}
and making the json:
string VAL_f0up_key = "2";
string VAL_filter_radius = "5";
string VAL_index_rate = "0.1";
string VAL_hop_length = "25";
string VAL_f0method = "dio";
string VAL_InputPath = "D:\\Projects\\VoiceChangerAI\\TestFile\\testa.wav";
string VAL_OutputPath = "D:\\Projects\\VoiceChangerAI\\TestFile\\output_API.wav";
string VAL_PthFile = "C:\\Users\\KCLEE\\Documents\\GitHub\\models\\LenvalBrown.pth";
string VAL_indexPath = "C:\\Users\\KCLEE\\Documents\\GitHub\\models\\LenvalBrown.index";
string VAL_SplitAudio = "false";
string VAL_AutoTune = "false";
string json =
$@"{{
""f0up_key"": ""{VAL_f0up_key}"",
""filter_radius"": ""{VAL_filter_radius}"",
""index_rate"": ""{VAL_index_rate}"",
""hop_length"": ""{VAL_hop_length}"",
""f0method"": ""{VAL_f0method}"",
""input_path"": ""{VAL_InputPath}"",
""output_path"": ""{VAL_OutputPath}"",
""pth_path"": ""{VAL_PthFile}"",
""index_path"": ""{VAL_indexPath}"",
""split_audio"": ""{VAL_SplitAudio}"",
""f0autotune"": ""{VAL_AutoTune}""
}}";
from rvc_cli.
hmmm i think there is something wrong with my json... - but when i try it in a python script - i get a "200" success... but that reads as error and doesn't actually create the file - which is progress considering all i ever got was "bad request" from the C# app... though unsure exactly what is wrong with the python POST request.
here is the code i was using for that...
import requests
import json
import time
url = "http://127.0.0.1:5000/infer"
payload = json.dumps({
"f0up_key": "2",
"filter_radius": "5",
"index_rate": "0.1",
"hop_length": "25",
"f0method": "dio",
"input_path": "D:\\Projects\\VoiceChangerAI\\TestFile\\testa.wav",
"output_path": "D:\\Projects\\VoiceChangerAI\\TestFile\\output_API.wav",
"pth_path": "C:\\Users\\KCLEE\\Documents\\GitHub\\models\\LenvalBrown.pth",
"index_path": "C:\\Users\\KCLEE\\Documents\\GitHub\\models\\LenvalBrown.index",
"split_audio": "false",
"f0autotune": "false"
})
headers = {
'Content-Type': 'application/json'
}
start_time = time.time() # Start the timer
response = requests.request("POST", url, headers=headers, data=payload)
end_time = time.time() # Stop the timer
if response.status_code == 200:
print("success:", response.text)
print("Time taken:", end_time - start_time, "seconds")
else:
print("Error:", response.text)
### output:
success: {"error":"Traceback (most recent call last):\n File "C:\Users\KCLEE\Documents\GitHub\RVC_CLI\rvc\infer\infer.py", line 252, in \n get_vc(model_path, 0)\n File "C:\Users\KCLEE\Documents\GitHub\RVC_CLI\rvc\infer\infer.py", line 195, in get_vc\n cpt = torch.load(person, map_location="cpu")\n File "C:\Users\KCLEE\Documents\GitHub\RVC_CLI\env\lib\site-packages\torch\serialization.py", line 986, in load\n with _open_file_like(f, 'rb') as opened_file:\n File "C:\Users\KCLEE\Documents\GitHub\RVC_CLI\env\lib\site-packages\torch\serialization.py", line 435, in _open_file_like\n return _open_file(name_or_buffer, mode)\n File "C:\Users\KCLEE\Documents\GitHub\RVC_CLI\env\lib\site-packages\torch\serialization.py", line 416, in init\n super().init(open(name, mode))\nFileNotFoundError: [Errno 2] No such file or directory: 'None'\n","output":""}
Time taken: 5.614147424697876 seconds
from rvc_cli.
I have published a new API system, you can check it out if you want - I'm not sure how it works, let me know if it doesn't work well and feel free to create a PR to improve it. You should use the same parameters you would use with the CLI.
At http://localhost:8000/docs you can see the documentation
from rvc_cli.
Related Issues (20)
- Stuff to improve GUI wise or ya get what i mean :3 HOT 2
- Training problem HOT 1
- [BUG] Training Threshold set to incorrect value when no value is set in command HOT 2
- [BUG] '<' not supported between instances of 'str' and 'float' HOT 2
- [BUG] '<' not supported between instances of 'str' and 'float' / No output file HOT 10
- Error: 'config' when trying to infer from a model that I trained HOT 1
- [BUG?] It is not possible to use more than one GPU for training on Kaggle HOT 7
- Issue with Model Output Generating Noise HOT 5
- [BUG] RVC doesn't produce a usable result with default settings HOT 3
- Docker HOT 1
- [BUG] HOT 1
- [BUG]
- file and folder name are same, "rvc". HOT 1
- Infer in kaggle got error message HOT 1
- Script Indicates Successful Execution, but No Audio Files Created
- Feature request: expose RVC (applio) functionality through python package HOT 2
- When I install it, no models are downloaded. HOT 3
- Crash when inference HOT 2
- [BUG] The api server is not starting HOT 1
- [Q/A] IndexError: tuple index out of range HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rvc_cli.