Let’s first create a Python file which will contain our Beam app definition. This is the environment you’ll be developing against once you start the app.
You can name your files whatever you’d like - Beam tries to limit the changes
you need to make to your existing code structure, so you can organize your
projects however you prefer.
You can run your code on this remote environment. It will feel as though you’re working locally, but all your code is actually being run on a container we’ve magically spun up for you.
Create a new file. This is the function you’ll be deploying on Beam.
run.py
Copy
Ask AI
def hello_world(**inputs): print("After deploying, you'll see these logs in the web dashboard 👀") return {"response": inputs["text"]}if __name__ == "__main__": text = "Testing 123" hello_world(text=text)
Click the Call API button in the dashboard. This will generate a cURL request for you to invoke the API. Copy the code, and paste it into your shell. You should see your logs and metrics appear in the dashboard.
Now that you’ve created a function, deployed it to prod, and invoked the API, you can explore some of our more advanced use cases, such as deploying an app on GPU or scheduling your tasks to run asyncronously using webhooks.