Deploy a Simple Web Endpoint
To run your code in the cloud, you just add a decorator. That’s it. Let’s write a simple function that finds the square of 256. We include numpy in the container image to show how you can easily add Python packages to your containers.-
Image()
defines your container environment. You can add Python packages, system dependencies, or even custom Dockerfiles. -
@endpoint
turns your function into a real, live web API that runs in the cloud.
app.py
for this example.
Deployment
With theapp.py
file saved on your computer, you can deploy this to the cloud using this command:
Call the API
After runningbeam deploy
, a cURL command will print in your shell. You can use this command to invoke the API.
Make sure to replace [TOKEN]
with your actual token.