Capstone 2 of 4
Deployed app
A FastAPI or Streamlit app live on a free host, with a public URL.
Turn your code into a small web app and put it online. Use FastAPI (an API you can call) or Streamlit (a simple page with inputs and outputs), and deploy it to a free host like Render or HuggingFace Spaces. Keep any secrets, like a password or key, in environment variables rather than typed into the code. Finish with a link that loads for anyone.
Before you submit
How to ship it
Render
- 1
Add a start command
Make sure your repo has a requirements.txt and a clear way to start the app (for FastAPI: uvicorn main:app --host 0.0.0.0 --port $PORT).
- 2
Create a Web Service
On render.com, choose New, then Web Service, and connect your GitHub repo. Set the start command from the step above.
- 3
Set your environment variables
In the service settings, add each secret under Environment. Never paste secrets into the code or the repo.
- 4
Open the live URL
When the deploy finishes, Render shows a public URL. Open it in a new private window to confirm it loads without you being signed in.
HuggingFace Spaces
- 1
Create a Space
On huggingface.co, choose New Space, pick Streamlit or Gradio, and make it public.
- 2
Add your app
Push your app.py and requirements.txt to the Space repo. The Space builds and runs automatically.
- 3
Add secrets
Put any keys in the Space Settings under Secrets, then read them from the environment in your code.
- 4
Confirm it loads
Wait for the build to finish, then open the Space URL in a private window to check a logged-out visitor sees it.
Submit and verify
Paste your public links. PythonCook checks them and, if anything is not ready, tells you the exact next step.
