{"id":20068557,"url":"https://github.com/tofull/faas_facebox","last_synced_at":"2025-10-24T03:38:37.356Z","repository":{"id":220589276,"uuid":"117903907","full_name":"Tofull/faas_facebox","owner":"Tofull","description":"OpenFaaS anonymize function. Use MachineBox service.","archived":false,"fork":false,"pushed_at":"2018-01-19T03:47:59.000Z","size":686,"stargazers_count":35,"open_issues_count":0,"forks_count":3,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-04-24T02:53:38.141Z","etag":null,"topics":["docker","face-detection","machine-learning","machinebox","openfaas","serverless"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Tofull.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2018-01-17T23:10:23.000Z","updated_at":"2020-09-16T19:22:35.000Z","dependencies_parsed_at":"2024-02-02T23:26:39.220Z","dependency_job_id":"298d044e-199b-4060-8263-713a6cffc964","html_url":"https://github.com/Tofull/faas_facebox","commit_stats":null,"previous_names":["tofull/faas_facebox"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tofull%2Ffaas_facebox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tofull%2Ffaas_facebox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tofull%2Ffaas_facebox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tofull%2Ffaas_facebox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Tofull","download_url":"https://codeload.github.com/Tofull/faas_facebox/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224461746,"owners_count":17315116,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","face-detection","machine-learning","machinebox","openfaas","serverless"],"created_at":"2024-11-13T14:07:33.628Z","updated_at":"2025-10-24T03:38:32.322Z","avatar_url":"https://github.com/Tofull.png","language":"Go","readme":"# OpenFaaS function : faceBox from MachineBox [![GitHub stars](https://img.shields.io/github/stars/Tofull/faas_facebox.svg?style=social\u0026label=Star)](https://GitHub.com/Tofull/faas_facebox/stargazers/)\n\n[![Twitter URL](https://img.shields.io/twitter/url/https/twitter.com/fold_left.svg?logo=twitter\u0026style=social\u0026label=_Tofull)](https://twitter.com/_Tofull) [![Github URL](https://img.shields.io/badge/style--green.svg?logo=github\u0026style=social\u0026label=tofull)](https://github.com/tofull)\n\n\n\nThis repository provides an OpenFaaS function to remove faces on pictures thanks to online machine learning service called MachineBox.\n\n\nInput                      |  Output                   |  [Output with blur effect](#apply-effect-on-face)\n:-------------------------:|:-------------------------:|:-------------------------:\n![my profile picture](https://avatars3.githubusercontent.com/u/15694700?s=400\u0026u=cccde5aa45d3d40fd4c00794bba3b74cce88488b\u0026v=4)  |  ![who is this ?](assets_for_documentation/anonymized_profile.jpg)  |  [![who is this ?](assets_for_documentation/blur_face.jpg)](#apply-effect-on-face)\n\n\n\n## Technical instructions\n### Installation\n1. You need the [OpenFaas CLI](https://github.com/openfaas/faas-cli) to build and deploy the function. So, first of all, you need to download it. \n    \n    `curl -sL https://cli.openfaas.com | sudo sh`\n\n2. This function is based on a MachineBox service called FaceBox. You can host your own facebox server with `docker run -p 8081:8080 -e \"MB_KEY=${MB_KEY}\" machinebox/facebox`. No worry, I already added this service for you in the OpenFaaS stack :thumbsup: .\n\n    By the way, you still have to get your own MachineBox key. Just [sign in on MachineBox](https://machinebox.io/login?return_url=%2Faccount).\n\n3. Set your MachineBox key as environment variable : \n\n    `MB_KEY=\"ThIsIsThEKeYiGeTfRoMhTtPs://mAcHiNeBoX.Io/aCcOuNt\"`\n\n4. Init your docker swarm cluster : \n\n    `docker swarm init`\n\n5. Deploy the OpenFaaS stack (embedded machinebox service on port 8081) : \n\n    `MB_KEY=${MB_KEY} docker stack deploy func --compose-file docker-compose.yml`\n\n6. Build the anonymizer function : \n    \n    `./build_all.sh`\n\n7. Deploy the function on OpenFaaS : \n    \n    `faas-cli deploy -f func_facebox.yml`\n\n\n### Anonymize your pictures !\n\nI arbitrary chose this picture for the test *(first Google Images item for keyword people)*: \n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"assets_for_documentation/example_people.jpg\" alt=\"people\" height=\"200\"/\u003e\n\u003c/p\u003e\n\n#### Via the OpenFaaS UI :\n1. On you browser (*http://localhost:8080*), you should get something like :\n![deployed openfaas stack](assets_for_documentation/deployed_openfaas_stack.png)\n\n2. Select the Download option and paste your image URL :\n![ui_function_invoke](assets_for_documentation/ui_function_invoke.png)\n\n3. Press **Invoke** button!\nYour anonymized picture is downloading.\n\n4. Open your anonymized picture with your favorite image viewer ! That rocks ! \n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"assets_for_documentation/example_anonymized_people.jpg\" alt=\"example_anonymized_people\" height=\"200\"/\u003e\n\u003c/p\u003e\n\n\n#### Via the OpenFaaS API : \nBecause OpenFaaS provides a REST API, you can invoke this function programmatically :\n\n```bash\nURL=\"http://epilepsyu.com/wp-content/uploads/2014/01/happy-people-1050x600.jpg\"\ncurl http://localhost:8080/function/anonymize -d \"${URL}\" \u003e example_anonymized_people_curl.jpg\n```\n\n\n### Cleanup :\n\n```bash\ndocker stack rm func\ndocker swarm leave --force\n```\n\n### Options : \n\n#### Use another FaceBox server url\nIf you want to use another FaceBox server url, simply change the *facebox* environment variable in file *func_facebox.yml* to fit with yours.\n```yaml\nfunctions:\n  anonymize:\n    lang: Dockerfile\n    handler: ./faas_anonymizer\n    image: functions/faas_anonymizer:latest\n    environment:\n      facebox: https://myFaceBoxServer\n```\n\n#### Apply effect on face\nRemove faces is too much for you ? Why not just blur the people ? \nJust set the environment *effect* to *blur*, or simply use the blur function I added for you.\n```yaml\nfunctions:\n  blur:\n    lang: Dockerfile\n    handler: ./faas_blur\n    image: functions/faas_blur:latest\n    environment:\n      facebox: http://localhost:8081\n      effect: blur\n```\n\n## Motivation\n\nThis challenge was given on [Twitter](https://twitter.com/openfaas/status/953356175919271936?ref_src=twsrc) : \n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://twitter.com/openfaas/status/953356175919271936?ref_src=twsrc\"\u003e \u003cimg src=\"assets_for_documentation/motivation.png\" alt=\"motivation\" height=\"400\"/\u003e \u003c/a\u003e\n\u003c/p\u003e\n\nThe function source code is strongly inspired from [this MachineBox blog post](https://blog.machinebox.io/how-i-built-an-image-proxy-server-to-anonymise-images-in-twenty-minutes-e550466ea09e).\n\n## Details\nFor more details about [Machine Box](https://machinebox.io/).\n\nFor more details about [OpenFaaS](https://www.openfaas.com/).\n\nGive this repository a star (because it's my first golang function hack) : [![GitHub stars](https://img.shields.io/github/stars/Tofull/faas_facebox.svg?logo=github\u0026style=social\u0026label=Star)](https://GitHub.com/Tofull/faas_facebox/stargazers/)\n\nFollow my activities : [![Twitter URL](https://img.shields.io/twitter/url/https/twitter.com/fold_left.svg?logo=twitter\u0026style=social\u0026label=_Tofull)](https://twitter.com/_Tofull) [![Github URL](https://img.shields.io/badge/style--green.svg?logo=github\u0026style=social\u0026label=tofull)](https://github.com/tofull) [![Blog URL](https://img.shields.io/badge/style--green.svg?style=social\u0026label=on%20my%20blog)](https://tofull.github.io/) \n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftofull%2Ffaas_facebox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftofull%2Ffaas_facebox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftofull%2Ffaas_facebox/lists"}