A Simple jQuery and Flask application that uses GhostScript under the hood to compress PDF files.
Here is the GhostScript magic command:
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf
Credits goes to Michael D response on this thread.