Web service for classifying audio samples.
The easiest way is to use docker.
Pull the image:
docker pull stevemurr/gencl
Run the image in the foreground:
docker run -p 8000:8000 -it stevemurr/gencl
Classify any audio sample as either a Male or Female sample.
You can:
POST request with audio data in the body.POST request with audio data in the file form field.Successful response for /gender endpoint looks like:
{
"class_names": [
"Male",
"Female"
],
"confidence": 0.9979417281844198,
"predicted": "Male",
"probabilities": [
0.9979417281844198,
0.0020582718155802244
],
"result": 0.0
}
I prefer http over curl.
brew install httpie
apt-get install httpie
dnf install httpie
yum install httpie
pacman -S httpie
pip install --upgrade pip setuptools
pip install --upgrade httpie
In the body:
http -f POST http://localhost:8000/gender < file-to-classify.wav
As a form:
http -f POST http://localhost:8000/gender file@~/Desktop/file-to-classify.wav
This form flow is the html equivalent of:
<form enctype="multipart/form-data" method="post" action="http://localhost:8000/gender">
<input type="file" name="file" />
</form>
var headers = new Headers();
// modify headers as needed
// headers.append("Content-Type", "");
var formData = new FormData();
formData.append("file", data);
var options = {
method: 'POST',
headers: headers,
body: formData,
}
fetch("http://localhost:8000/gender", options).then((res) => {
return res.json();
}).then((j) => {
console.log(j)
}).catch((err) => {
console.log(err)
})
import requests
with open("file-to-classify.wav", "r") as f:
r = requests.post("http://localhost:8000/gender", data=f.read())
print(r.json())
Accepts speech audio as input and returns arousal and valence. Arousal denotes intensity and valence denotes emotional affectivity.
X axis is valence Y axis is arousal
A basic cheat sheet for interpreting values could be:
Intense & Sad | Intense & Emotional
(-, +) | (+, +)
|
-------------------------------------
Somber & Sad | Somber & Emotional
(-, -) | (+, -)
|
Successful response for /emotion endpoint looks like:
{
"arousal": -0.44036897518838625,
"class_names": [
"arousal",
"valence"
],
"result": [
-0.44036897518838625,
-0.25920978580531595
],
"valence": -0.25920978580531595
}
In the body:
http -f POST http://localhost:8000/emotion < file-to-classify.wav
As a form:
http -f POST http://localhost:8000/emotion file@~/Desktop/file-to-classify.wav
This form flow is the html equivalent of:
<form enctype="multipart/form-data" method="post" action="http://localhost:8000/emotion">
<input type="file" name="file" />
</form>
var headers = new Headers();
// modify headers as needed
// headers.append("Content-Type", "");
var formData = new FormData();
formData.append("file", data);
var options = {
method: 'POST',
headers: headers,
body: formData,
}
fetch("http://localhost:8000/emotion", options).then((res) => {
return res.json();
}).then((j) => {
console.log(j)
}).catch((err) => {
console.log(err)
})
import requests
with open("file-to-classify.wav", "r") as f:
r = requests.post("http://localhost:8000/emotion", data=f.read())
print(r.json())
Content type
Image
Digest
Size
339.1 MB
Last updated
over 8 years ago
docker pull stevemurr/gencl