Welcome to our repository on GitHub! Here you will find the source code of a python library that can be used to communicate with the Affectiva Emotion API service to process videos or images. For more information, visit our Affectiva's Developer Portal.
- Python 2.7
- requests
git clone https://github.com/Affectiva/emotion-api-python.git
cd emotion-api-python
python setup.py sdist
pip install dist/AffectivaEmotionAPI-0.0.1.tar.gz
**Sign up for credentials: ** http://developer.affectiva.com/apioverview/
Upload an Image or a Video file for processing ?
import affectiva.api
username = 'API_USER'
passwd = 'API_PASSWD'
api = affectiva.api.EmotionAPI(username,passwd)
# Upload a file for Processing
filename = '/home/mahmoud/Desktop/test_file.mp4'
job_url = api.create_job(filename)['self']
**Get face detection and emotion results **
job_status = api.query_job(job_url)['status']
if status == 'done':
metrics_json = api.results(job_url)