{"id":15345438,"url":"https://github.com/jthomas/serverless-max-models","last_synced_at":"2026-01-18T19:35:46.317Z","repository":{"id":140706521,"uuid":"192765346","full_name":"jthomas/serverless-max-models","owner":"jthomas","description":"Run Model Asset eXchange models as serverless functions on IBM Cloud Functions","archived":false,"fork":false,"pushed_at":"2019-07-24T20:55:11.000Z","size":4,"stargazers_count":3,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-06T13:33:49.597Z","etag":null,"topics":["cloud-functions","ibm","ibmcloud","machine-learning","serverless"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jthomas.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"publiccode":null,"codemeta":null}},"created_at":"2019-06-19T16:08:44.000Z","updated_at":"2020-02-12T00:44:46.000Z","dependencies_parsed_at":null,"dependency_job_id":"21b2e254-22c3-419c-8ba9-0c32c3627c01","html_url":"https://github.com/jthomas/serverless-max-models","commit_stats":{"total_commits":1,"total_committers":1,"mean_commits":1.0,"dds":0.0,"last_synced_commit":"1dbcd51fd161daa51620c6782d8859cc3e14d0fa"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jthomas/serverless-max-models","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jthomas%2Fserverless-max-models","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jthomas%2Fserverless-max-models/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jthomas%2Fserverless-max-models/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jthomas%2Fserverless-max-models/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jthomas","download_url":"https://codeload.github.com/jthomas/serverless-max-models/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jthomas%2Fserverless-max-models/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28549482,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T19:22:41.102Z","status":"ssl_error","status_checked_at":"2026-01-18T19:22:26.310Z","response_time":98,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["cloud-functions","ibm","ibmcloud","machine-learning","serverless"],"created_at":"2024-10-01T11:13:24.706Z","updated_at":"2026-01-18T19:35:46.300Z","avatar_url":"https://github.com/jthomas.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Model Asset eXchange + IBM Cloud Functions\n\nThis repo contains the instructions and scripts needed to run machine learning prediction models from the [Model Asset eXchange (MAX)](https://developer.ibm.com/exchanges/models/) on [IBM Cloud Functions](https://cloud.ibm.com/openwhisk) ([Apache OpenWhisk](https://openwhisk.apache.org/)).\n\nMAX models [supporting deployment](https://developer.ibm.com/exchanges/models/all/?fa=date%3ADESC\u0026fb=14525) are already published as [public images](https://hub.docker.com/u/codait) on Docker Hub. Augmenting these images to support the [Docker action interface](https://github.com/apache/incubator-openwhisk/blob/master/docs/actions-docker.md) used by Apache OpenWhisk means they can be executed as Apache OpenWhisk Actions. Apache OpenWhisk [Web Actions](https://github.com/apache/incubator-openwhisk/blob/master/docs/webactions.md) can be then be used to create the HTTP services to implement the prediction APIs.\n\n## requirements\n\n- [Docker](https://www.docker.com/)\n- [Docker Hub account](https://hub.docker.com/)\n- [IBM Cloud account](https://cloud.ibm.com/registration) \n- [IBM Cloud Functions CLI installed](https://cloud.ibm.com/openwhisk/learn/cli)\n\n## usage\n\n### build custom runtime images\n\n- Set the following environment variables (`MODELS`) with MAX model names and run build script.\n  - `MODELS`: MAX model names, e.g. `max-facial-emotion-classifier`\n  - `USERNAME`: Docker Hub username.\n\n```\nMODELS=\"...\" USERNAME=\"...\" ./build.sh\n```\n\nThis will create Docker images locally with the MAX model names and push to Docker Hub for usage in IBM Cloud Functions. IBM Cloud Functions only supports public Docker images as custom runtimes. \n\n### create actions using custom runtimes\n\n- Create Web Action using custom Docker runtime.\n\n```\nibmcloud wsk action create \u003cMODEL_IMAGE\u003e --docker \u003cDOCKERHUB_NAME\u003e/\u003cMODEL_IMAGE\u003e --web true -m 512\n```\n\n- Retrieve Web Action URL (`https://\u003cREGION\u003e.functions.cloud.ibm.com/api/v1/web/\u003cNS\u003e/default/\u003cACTION\u003e`)\n\n```\nibmcloud wsk action get \u003cMODEL_IMAGE\u003e --url\n```\n\n### invoke web action url with prediction api parameters\n\nUse the same API request parameters as defined in the Prediction API specification with the Web Action URL. This will invoke model predictions and return the result as the HTTP response, e.g.\n\n```\ncurl -F \"image=@assets/happy-baby.jpeg\" -XPOST \u003cWEB_ACTION_URL\u003e\n```\n\n*NOTE: The first invocation after creating an action may incur long cold-start delays due to the platform pulling the remote image into the local registry. Once the image is available in the platform, both further cold and warm invocations will be much faster.*\n\n## models\n\nThe following MAX models have been tested with this library and can be confirmed as working...\n\n### max-facial-emotion-classifier\n\n- [Facial Emotion Classifier (`max-facial-emotion-classifier`)](https://developer.ibm.com/exchanges/models/all/max-facial-emotion-classifier/)\n\nHere is an example of using this model. Start by creating the action using the custom runtime and then retrieve the Web Action URL.\n\n```\n$ ibmcloud wsk action create max-facial-emotion-classifier --docker \u003cDOCKERHUB_NAME\u003e/max-facial-emotion-classifier --web true -m 512\nok: created action max-facial-emotion-classifier\n$ ibmcloud wsk action get max-facial-emotion-classifier --url\nok: got action max-facial-emotion-classifier\nhttps://\u003cREGION\u003e.functions.cloud.ibm.com/api/v1/web/\u003cNS\u003e/default/max-facial-emotion-classifier\n```\n\nAccording to the [API definition](http://max-facial-emotion-classifier.max.us-south.containers.appdomain.cloud/) for this model, the prediction API expects a form submission with an image file to classify. Using a [sample image](https://github.com/IBM/MAX-Facial-Emotion-Classifier/blob/master/assets/happy-baby.jpeg) from the model repo, the model can be tested using curl.\n\n```\n$ curl -F \"image=@happy-baby.jpeg\" -XPOST https://\u003cREGION\u003e.functions.cloud.ibm.com/api/v1/web/\u003cNS\u003e/default/max-facial-emotion-classifier\n```\n\n```json\n{\n  \"status\": \"ok\",\n  \"predictions\": [\n    {\n      \"detection_box\": [\n        0.15102639296187684,\n        0.3828125,\n        0.5293255131964809,\n        0.5830078125\n      ],\n      \"emotion_predictions\": [\n        {\n          \"label_id\": \"1\",\n          \"label\": \"happiness\",\n          \"probability\": 0.9860254526138306\n        },\n        ...\n      ]\n    }\n  ]\n}\n```\n\n#### performance\n\n*Example Invocation Duration (Cold):* ~4.8 seconds\n\n*Example Invocation Duration (Warm):* ~ 800 ms\n\n### max-image-resolution-enhancer\n\n- [Image Resolution Enhancer (`max-image-resolution-enhancer`)](https://developer.ibm.com/exchanges/models/all/max-image-resolution-enhancer/)\n\nHere is an example of using this model. Start by creating the action using the custom runtime and then retrieve the Web Action URL.\n\n```\n$ ibmcloud wsk action create max-image-resolution-enhancer --docker \u003cDOCKERHUB_NAME\u003e/max-image-resolution-enhancer --web true -m 2048\nok: created action max-image-resolution-enhancer\n$ ibmcloud wsk action get max-image-resolution-enhancer --url\nok: got action max-image-resolution-enhancer\nhttps://\u003cREGION\u003e.functions.cloud.ibm.com/api/v1/web/\u003cNS\u003e/default/max-image-resolution-enhancer\n```\n\nAccording to the [API definition](http://max-facial-emotion-classifier.max.us-south.containers.appdomain.cloud/) for this model, the prediction API expects a form submission with an image file to classify. Using a [sample image](https://raw.githubusercontent.com/IBM/MAX-Image-Resolution-Enhancer/master/samples/test_examples/low_resolution/woman.png) from the model repo, the model can be tested using curl.\n\n```\n$ curl -F \"image=@woman.png\" -XPOST https://\u003cREGION\u003e.functions.cloud.ibm.com/api/v1/web/\u003cNS\u003e/default/max-facial-emotion-classifier \u003e output.png\n```\n\nOpening the `output.png` should reveal the high-resolution version of the [sample image](https://raw.githubusercontent.com/IBM/MAX-Image-Resolution-Enhancer/master/samples/test_examples/low_resolution/woman.png).\n\n#### performance\n\n*Example Invocation Duration (Cold):* ~4.8 seconds\n\n*Example Invocation Duration (Warm):* ~ 14 seconds\n\n### max-human-pose-estimator\n\n- [Human Pose Estimator (`max-human-pose-estimator`)](https://developer.ibm.com/exchanges/models/all/max-human-pose-estimator/)\n\nHere is an example of using this model. Start by creating the action using the custom runtime and then retrieve the Web Action URL.\n\n```\n$ ibmcloud wsk action create max-human-pose-estimator --docker \u003cDOCKERHUB_NAME\u003e/max-human-pose-estimator --web true -m 512\nok: created action max-human-pose-estimator\n$ ibmcloud wsk action get max-human-pose-estimator --url\nok: got action max-human-pose-estimator\nhttps://\u003cREGION\u003e.functions.cloud.ibm.com/api/v1/web/\u003cNS\u003e/default/max-human-pose-estimator\n```\n\nAccording to the [API definition](https://github.com/IBM/MAX-Human-Pose-Estimator#3-use-the-model) for this model, the prediction API expects a form submission with an image file to classify. Using a [sample image](https://github.com/IBM/MAX-Human-Pose-Estimator/blob/master/assets/Pilots.jpg) from the model repo, the model can be tested using curl.\n\n```\n$ curl -F \"file=@Pilots.jpg\" -XPOST https://\u003cREGION\u003e.functions.cloud.ibm.com/api/v1/web/\u003cNS\u003e/default/max-human-pose-estimator\n```\n\n```json\n{\n  \"status\": \"ok\",\n  \"predictions\": [\n    {\n      \"human_id\": 0,\n      \"pose_lines\": [\n        ...\n      ],\n      \"body_parts\": [\n        ...\n      ]\n   }\n    ...\n}\n```\n\n#### performance\n\n*Example Invocation Duration (Cold):* ~6 seconds\n\n*Example Invocation Duration (Warm):* ~ 600 ms\n\n### max-facial-age-estimator\n\n- [Facial Age Estimator (`max-facial-age-estimator`)](https://developer.ibm.com/exchanges/models/all/max-human-pose-estimator/)\n\nHere is an example of using this model. Start by creating the action using the custom runtime and then retrieve the Web Action URL.\n\n```\n$ ibmcloud wsk action create max-facial-age-estimator --docker \u003cDOCKERHUB_NAME\u003e/max-facial-age-estimator --web true -m 512\nok: created action max-facial-age-estimator\n$ ibmcloud wsk action get max-facial-age-estimator --url\nok: got action max-facial-age-estimator\nhttps://\u003cREGION\u003e.functions.cloud.ibm.com/api/v1/web/\u003cNS\u003e/default/max-facial-age-estimator\n```\n\nAccording to the [API definition](http://max-facial-age-estimator.max.us-south.containers.appdomain.cloud/) for this model, the prediction API expects a form submission with an image file to classify. Using a [sample image](https://raw.githubusercontent.com/IBM/MAX-Facial-Age-Estimator/master/assets/tom_cruise.jpg) from the model repo, the model can be tested using curl.\n\n```\n$ curl -F \"image=@tom_cruise.jpg\" -XPOST https://\u003cREGION\u003e.functions.cloud.ibm.com/api/v1/web/\u003cNS\u003e/default/max-facial-age-estimator\n```\n\n```json\n{\n  \"status\": \"ok\",\n  \"predictions\": [\n    {\n      \"age_estimation\": 47,\n      \"detection_box\": [\n        0.147,\n        0.3079667063020214,\n        0.562,\n        0.6813317479191439\n      ]\n    }\n  ]\n}\n```\n\n#### performance\n\n*Example Invocation Duration (Cold):* ~7 seconds\n\n*Example Invocation Duration (Warm):* ~500 ms\n\n## issues\n\nTensorFlow based models seem very memory hungry. Using larger images often needs the action memory increasing to the maximum 2 GB allowed and sometimes this is not enough. ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjthomas%2Fserverless-max-models","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjthomas%2Fserverless-max-models","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjthomas%2Fserverless-max-models/lists"}