The world's first DTHaaS (Donald Trump Hats as a Service) API and client!
As seen at sudo HackStetson (Devpost link here).
Trumpatize-me is written in Python 2.7 with the help of the following packages:
- OpenCV for image processing tasks
- Flask for handling API calls
On Ubuntu/Debian Linux, you may install these using the following commands:
sudo pip install -r requirements.txt
sudo apt-get install python-opencv
Trumpatize-me has two parts: the API that allows you to upload images to be "trumpatized", and a client that trumpatizes your webcam video.
- Make sure that OpenCV is installed and that you have a webcam. (Flask is only used for the API)
- Run main.py
- Enjoy!
- Make sure that OpenCV and Flask are installed.
- Run api_server.py.
- Congrats! Your computer is now hosting the API!
The API accepts a POST packet with the following parameters:
parameter | required? | values |
---|---|---|
image | yes | (your image) |
hat_type | no | red, white, camo |
A sample curl request is as follows:
curl -o bernie_with_hat.jpg \
-F hat_type=red \
-F image=@bernie.jpg \
http://trumpatize.me/api/
NOTE: http://trumpatize.me site does not currently have API support. (coming soon!)
When the API server runs on your computer, the default port used by Flask is 5000. Thus, to test the API locally, the url would be http://localhost:5000/api/