API query returns 500 error
When I run the suggested (at the bottom of the page) API query in python, I get 500 error. Here is the copy/pasted snippet.
Is there something wrong with this query?
response = requests.post("https://bilalsardar-voice-cloning.hf.space/run/predict", json={
"data": [
"hello world",
{"name":"audio.wav","data":"data:audio/wav;base64,UklGRiQAAABXQVZFZm10IBAAAAABAAEARKwAAIhYAQACABAAZGF0YQAAAAA="},
{"name":"audio.wav","data":"data:audio/wav;base64,UklGRiQAAABXQVZFZm10IBAAAAABAAEARKwAAIhYAQACABAAZGF0YQAAAAA="},
]}).json()
That code is just a sample, you have to covert your audio in base 64 by yourself and then use it.
Here is the code to convert audio file to base 64
import base64
with open("record.wav", "rb") as f1,open("b64.txt", "w") as f2:
encoded_f1 = base64.b64encode(f1.read())
encoded_f1=str(encoded_f1,'ascii', 'ignore')
filedata="data:audio/wav;base64,"+encoded_f1
f2.write("data:audio/wav;base64,")
f2.write(str(encoded_f1))
import requests
response = requests.post("https://bilalsardar-voice-cloning.hf.space/run/predict", json={
"data": [
"hello world world how are you",
{"name":"audio.wav","data":filedata},
{"name":"audio.wav","data":filedata},
]}).json()
data = response["data"]
API still throwing 500 error with my own created base64