Chapter 10 of 1140 min
Share it
- Load
- Chunk
- Embed
- Search
- Ask the AI
- App
In this chapter you will:
- put your project on your own GitHub
- write the list of packages a server needs to run your app
- put your app online, with your API key kept secret, and get a link anyone can open
Put it on your GitHub
Your project was cloned from the JrCodex starter, so Git still points there. Point it at your own copy instead.
- On github.com, sign in (or sign up), click New repository, name it
ask-my-docs, keep it Public, and leave every box below unticked. Create it. - In your terminal, with your own user name in place of
YOUR-NAME:
git remote set-url origin https://github.com/YOUR-NAME/ask-my-docs.git
git push -u origin mainOpen your repository page. Your code is there, and so is your history: every chapter's commit. That history is part of what makes it a portfolio project: it shows how you built it.
Look through the files on GitHub once more. .env must not be there.
List what the app needs
Your laptop has the packages installed; a server starting from nothing doesn't. Create requirements.txt in the project folder:
--extra-index-url https://download.pytorch.org/whl/cpu
torch
sentence-transformers
google-genai
python-dotenv
streamlitThe first line tells pip where to find the small version of PyTorch for computers without a graphics card, which is what free servers are. Without it the install is several times bigger and may not fit.
git add requirements.txt
git commit -m "Chapter 10: requirements"
git pushPut it online
Streamlit Community Cloud runs Streamlit apps for free, straight from GitHub.
- Sign in with your GitHub account.
- Click Create app, then choose to deploy from GitHub.
- Pick your
ask-my-docsrepository, branchmain, and main fileapp.py. - Open Advanced settings. Choose Python 3.12. In Secrets, paste one line with your key:
GEMINI_API_KEY = "paste-your-key-here"- Click Deploy. The first build installs everything, so it takes a few minutes.
Your .env file never left your laptop, so the server gets the key from these secrets instead. Streamlit hands each secret to your app as an environment variable, which is exactly where genai.Client() looks. No code change needed.
When it's done, you get a link like https://your-app-name.streamlit.app. Open it on your phone. That's your app, live.
Anyone with the link uses your free Gemini quota. That's fine for showing friends or an interviewer. Don't post it somewhere thousands of people will click it. If the build fails, the log on the right of the page shows the error; the most common cause is a typo in requirements.txt.
Make the README yours
Your repository's README.md still describes the starter. Rewrite it for someone visiting your GitHub: what the app does, the link to the live app, how it works (load, chunk, embed, search, ask the AI), and how to run it locally. A screenshot of the app makes it much stronger. Commit and push.
Predict, then check
An interviewer asks: "Why didn't you just send the whole handbook to Gemini?" What do you answer?
Show answerHide answer
Something like: "For five files I could have. But real document sets are far bigger than a model can take in, and sending everything is slow and costly. Retrieval sends only the three most relevant chunks, so the answer stays fast, cheap and grounded in the right passages, and the app can cite its source." That's the whole idea of RAG, in your own words.
Save your progress
git add .
git commit -m "Chapter 10: shared online"
git pushStuck, or want to compare? The finished code for this chapter is tagged ch10: run git diff ch10, or see it on GitHub.