How jasmeetsb/google_generative_ai_samples works
Project Type and Purpose
• This repo is a collection of Generative AI sample apps and utilities. It includes:
• Interactive Flask UIs (chat‐flask‐cloudrun, dynamic_webpage)
• A Hugging Face model‐serving demo (model_serving/hf_model_serving)
• Jupyter notebooks for Doc AI + Palm API use cases
• Utility scripts for load tests and data conversion
• Purpose: demonstrate end‐to‐end GenAI workflows (document extraction, conversational AI) on GCP & HF.
File Structure
• Top‐level directories:
• Utilities: batch scripts, load testing, data conversion
• chat‐flask‐cloudrun: Flask chat UI, Dockerfile for Cloud Run
• dynamic_webpage: Another Flask demo, Dockerfile + Procfile (Heroku)
• model_serving/hf_model_serving: Flask server for local HF models
• sample_data: PDF assets for Doc AI
• Scratch: playground code
• Config files: Dockerfiles, Procfiles, requirements.txt → deployment targets: Cloud Run, Heroku, local.
Extract Architectural Insights from README
• Key GenAI components:
• Doc AI (GCP) for document ingestion
• Palm API (Vertex AI) for generative responses
• Notebooks illustrate orchestration of these services offline.
Main Components & Their Relationships
a. User Interfaces (Frontend)
• chat‐flask‐cloudrun: Web UI for conversational AI
• dynamic_webpage: Sample dynamic web UI
• Notebooks: serve as offline UIs for data scientists
b. Application Backends
• Flask apps (in each demo folder) accept HTTP requests, format prompts, call AI services
• model_serving/hf_model_serving: hosts HF models via REST
c. AI Services (External & Internal)
• Google Vertex AI Palm API (Generative AI)
• Google Doc AI (OCR & entity extraction)
• Hugging Face models (local or cloud) via custom server
d. Data Layer
• sample_data: PDFs are ingested by Doc AI
• No persistent database in samples—state is ephemeral in memory
e. Utility Scripts
• load_test.py, latency measurement notebooks: used to benchmark API latency
• csv_to_jsonl_converter.ipynb: data prep for fine‐tuning or evaluation
Architectural Patterns & Design Principles
• Microservices style: each demo lives in its own container
• Clear separation between UI, orchestration layer (Flask), and AI services
• Scalable deployments via Docker + Cloud Run / Heroku
• Extensible: new demos, new AI backends can be “dropped in” as separate services
Checklist
• [ ] Clear labels on all components (e.g., “chat‐flask‐cloudrun container,” “Vertex AI Palm API”)