Copy import requests
API_URL = "https://ddb95svxi9vs16zy.us-east-1.aws.endpoints.huggingface.cloud"
headers = {
"Accept": "application/json",
"Authorization": "Bearer <hf_token>",
"Content-Type": "audio/wav",
}
def query(filename):
with open(filename, "rb") as f:
data = f.read()
response = requests.post(API_URL, headers=headers, data=data)
return response.json()
output = query("sample1.wav")
Copy import requests
API_URL = "https://l9w4uzm374uyn9xk.us-east-1.aws.endpoints.huggingface.cloud"
headers = {
"Accept": "application/json",
"Authorization": "Bearer HF_token",
"Content-Type": "audio/wav",
}
def query(filename):
with open(filename, "rb") as f:
data = f.read()
response = requests.post(API_URL, headers=headers, data=data)
return response.json()
output = query("sample1.wav")
Copy curl "https://l9w4uzm374uyn9xk.us-east-1.aws.endpoints.huggingface.cloud/" \
-X POST \
--data-binary '@sample1.flac' \
-H "Accept: application/json" \
-H "Authorization: Bearer hf_XXXXX" \
-H "Content-Type: audio/flac" \// Some code
Copy import requests
API_URL = "https://h3xisjmpemyv68l1.us-east-1.aws.endpoints.huggingface.cloud/"
headers = {
"Accept" : "application/json",
"Authorization": "Bearer hf_xxxx",
"Content-Type": "audio/wav"
}
def query(filename):
with open(filename, "rb") as f:
data = f.read()
response = requests.post(API_URL, headers=headers, data=data)
return response.json()
output = query("sample.wav")
print(output)