Developing & Deploying Serverless Apps made easy using Nimbella & Python

  1. If you are having multiple python files & imports, make the name of the entry file as __main__.py & define a main function in it.
  2. The return from the main function should be json with the key body.

FACT CHECK API

Now following the above points I changed the hello world program to fact-check api by making necessary changes.

  1. Write the code the necessary code to call the google fact check (refer here)
  2. For sake of simplicity, first hardcode the API_KEY variable (If you are following the above reference).
  3. To test this code, define the name constructor at end & call the functions you need to test. Later run the command `python __main__.py`
  4. Once you are sure your code is working fine, you can run the commands to deploy & invoke as shown in case of hello world action as above.

URGENCY OF HOSPITAL ADMISSION CHECK API

  1. For this api, I trained a random forest model using the sklearn library using the covid-19 data from here.
  2. Save the model using Joblib
  3. Place the joblib file in the action directory (default/urcheck/models). Refer here.
  4. Load the file to make the predictions using the response received from the end user.
  5. Once you are sure that code is free from bugs, you can run the commands to deploy & invoke as discussed earlier.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store