Beam includes a live-reloading feature that allows you to run your code on the same environment you’ll be running in production.
By default, Beam will sync all the files in your working directory to the remote container. This allows you to use the files you have locally while developing. If you want to prevent some files from getting uploaded, you can create a .beamignore.
In your shell, run beam serve app.py. This will:
Spin up a container
Run the container on a cloud machine
Print a cURL request to invoke the API
Stream the logs to your shell
You should keep this terminal window open while developing.
(.venv) user@MacBook demo % beam serve app.py i Using cached image. ✓ App initialized. i Uploading files... ✓ Container scheduled, logs will appear below.⠴ Starting container... 5s (Estimated: 3m20s)================= Call the API =================curl -X GET https://eh1dq-655a376a6d7360000745eaef.apps.beam.cloud============= Logs Streamed Below ==============Gradio server is not up yet, waiting...Gradio app is readyINFO: | GET - /INFO: | GET - /assets/index-5550136d.jsINFO: | GET - /assets/index-449ec8c6.css
Now, head back to your IDE, and change a line of code. Hit save.If you look closely at the shell running beam serve, you’ll notice the server reloading with your code changes.You’ll use this workflow anytime you’re developing an app on Beam. Trust us — it makes the development process uniquely fast and painless.