Repository doc · gemini/sample-apps/quickbot/linkedin-profile-image-generation-using-imagen3/backend/README.md · Open on GitHub · Part of Gemini Notebooks
QuickBot App is a set of templates that can be deployed out of the box into Cloud Run and work independently. Each one can be run independently connected to the user default google cloud auth credentials, and based on the complexity of each template, may require to deploy more or less resources into our Google Cloud Project.
The architecture always follows the following structure: a folder for the frontend which consists in an Angular app, and a backend folder which consists of a FastAPI Python app.
Setting up
1. Create virtualenv inside the backend folder and install dependencies
Create a virtual environment on the root of the application, activate it and install the requirements
# check if you are already in the env
pip -V
# if not then
python3 -m venv .venv
source .venv/bin/activate
pip3 install -r requirements.txt
IMPORTANT! VS Code may not recognize your env, in that case type “ctrl + shift + P”, then select “Python: Select Interpreter” and then select “Enter interpreter path…” and then select your .venv python interpreter, in this case .backend/.venv/bin/python
2. Setup gcloud credentials
gcloud auth list
gcloud config list
gcloud auth login
gcloud config set project <your project id>
gcloud auth application-default set-quota-project <your project id>
gcloud auth list
gcloud config list
3. Add environment variables
If you have Mac or Windows (or if you are using zsh console on Linux)
. ./local.env
If you have Linux
Open the file .venv/bin/activate and paste the env variables from .local.env after the PATH export, like this:
Initialize gts (if not already done in the project):
Navigate to the frontend/ directory and run:
npx gts init
This will set up gts and create necessary configuration files (like tsconfig.json). Ensure your tsconfig.json (or a related gts config file like .gtsrc) includes an extension for gts defaults, typically:
{ "extends": "./node_modules/gts/tsconfig-google.json", // ... other configurations}
Check for linting issues:
npm run lint
(This assumes a lint script is defined in package.json, e.g., "lint": "gts lint")
(This assumes a fix script is defined in package.json, e.g., "fix": "gts fix")
Backend (Python with pylint and black)
Ensure Dependencies are Installed:
Add pylint and black to your backend/requirements.txt file:
pylint
black
Then install them within your virtual environment:
pip install pylint black# or pip install -r requirements.txt
Configure pylint:
It’s recommended to have a .pylintrc file in your backend/ directory to configure pylint rules. You might need to copy a standard one or generate one (pylint --generate-rcfile > .pylintrc).
Check for linting issues with pylint:
Navigate to the backend/ directory and run: