A Progressive Web Application (PWA) that uses Google Cloud's Vertex AI with Gemini Flash to analyze images and generate relevant hashtags. The application combines multimodal AI capabilities to understand image content and generate appropriate hashtags, making it easier to tag and categorize images for social media.
- Image analysis using Vertex AI's Gemini Flash
- Progressive Web App (PWA) for native-like experience
- Google Cloud Storage integration for image storage
- AI-Generated UI/UX design
- Support for multiple image formats (PNG, JPG, JPEG, GIF, WEBP)
To run the application locally, follow these steps:
- Create the virtual environment and install the dependencies:
python3 -m venv venv source venv/bin/activate pip install -r requirements.txt - Create the
.env.devfile with the following environment variables:Of course, replaceGOOGLE_CLOUD_PROJECT="your-project-id" BUCKET_NAME="your-bucket-name"
your-project-idandyour-bucket-namewith your actual Google Cloud project ID and bucket name. - Run it using the following command:
python app.py
If you use vscode the launch.json file is already configured to run the application.
There are two ways to run the application in production mode using Docker:
- Ensure you have your Google Cloud credentials JSON file ready.
- Set the
GOOGLE_CREDENTIALS_PATHenvironment variable to point to your credentials file:export GOOGLE_CREDENTIALS_PATH=/path/to/your/credentials.json - Start the application:
docker compose up --no-recreate
- First, ensure you have your Google Cloud credentials JSON file ready.
- Export the following environment variables:
export GOOGLE_CLOUD_PROJECT="your-project-id" export BUCKET_NAME="your-bucket-name"
- Build the Docker image with the following command:
docker build -t htgen . - Run the Docker container with the following command:
Replace
docker run -p 8000:8000 \ -e GOOGLE_CLOUD_PROJECT=$GOOGLE_CLOUD_PROJECT \ -e BUCKET_NAME=$BUCKET_NAME \ -e GOOGLE_CREDENTIALS_PATH="/app/credentials.json" \ -v /path/to/your/credentials.json:/app/credentials.json \ htgen
/path/to/your/credentials.jsonwith the path to your Google Cloud credentials JSON file.
GOOGLE_CLOUD_PROJECT: Your Google Cloud project IDBUCKET_NAME: The Google Cloud Storage bucket name for storing imagesGOOGLE_CREDENTIALS_PATH: Path to the credentials file inside the container (should be inside /app, so "/app/credentials.json" is the default value)
The service account credentials file needs to be mounted into the container. Both Docker Compose and the Docker CLI command map your local credentials file into the container at /app/credentials.json.
You can run the application as a systemd service to ensure it starts automatically on boot and is managed by the system.
-
Copy the service file to systemd directory:
sudo cp [email protected] /etc/systemd/system/
-
Edit the service file to set your paths and user:
sudo nano /etc/systemd/system/[email protected]
Update the following:
- Replace
WorkingDirectory=/home/plox/htgen/with your project directory path - Update the
GOOGLE_CREDENTIALS_PATHin ExecStart to point to your credentials file
- Replace
-
Reload systemd to recognize the new service:
sudo systemctl daemon-reload
-
Enable and start the service (replace
yourusernamewith your system username):sudo systemctl enable htgen@yourusername sudo systemctl start htgen@yourusername
Note: https://chromeos.dev/en/publish/pwa-in-play followed for publishing on the Google Play Store.
- Keep the
assetlinks.jsonfrom the Play Console in Configuration -> App Signature -> JSON Digital Asset Links cp assetlinks.json htgen/static/assetlinks.json
Google Cloud credits are provided for this project. #VertexAISprint