How shubrotodas10/tourvision works
1. Repository shape
- This is a small, single-process Python pipeline rather than a multi-service application.
- The core orchestrator appears to be tourVision.py (the README references pipeline_new.py, but the file tree shows tourVision.py as the main entry point).
2. Primary purpose
- The system converts a folder of property photos into a polished tour video.
- The architecture is a linear media-processing pipeline: local images in → AI classification → AI video generation → local video stitching → final MP4 out.
3. Input boundary: property image folders
- Source media lives under images/{PROPERTY_CODE}/.
- The pipeline expects typical photo formats such as .webp, .jpg, and .jpeg.
- Each property is treated as a separate batch keyed by a property code.
4. Configuration and environment
- Runtime settings are driven by constants in the script, including property code, source/output paths, transition duration, and target video length.
- Secrets are externalized through .env, primarily the GEMINI_API_KEY.
- This makes the pipeline environment-driven, with behavior changing per property and per deployment machine.
5. AI classification subsystem
- Google Gemini Vision (gemini-2.0-flash) is used to inspect each image and infer room/scene labels.
- This stage is responsible for turning unstructured photos into structured scene groups like bedroom, kitchen, living room, exterior, and amenities.
- The output of this stage is the key data model for the rest of the pipeline: images grouped by detected room type.
6. Scene grouping and selection logic
- After classification, images are grouped by label to create room-specific scene sets.
- For rooms with multiple images, the pipeline selects the best pair for transition-friendly clips.
- This stage is the main decision boundary that determines clip ordering and how many generated scenes the final tour will contain.
7. Video generation subsystem
- Google Veo 3.1 Fast (veo-3.1-fast-generate-preview) is used to generate cinematic clips from the selected images.
- Single-image scenes are prompted as smooth panorama-style shots.
- Multi-image scenes are prompted as frame-bridge or transition shots, giving the tour motion between views.
- This is an external cloud AI boundary: local code submits prompts and images, then waits for asynchronous generation results.
8. Local media assembly
- MoviePy is used after generation to stitch the scene clips into one final video.
- The final assembly applies crossfades and timing adjustments so the total output matches the target duration.
- This is the main local post-processing boundary, separate from the cloud AI generation step.
9. Output artifacts
- Generated assets are written under output/{PROPERTY_CODE}/.
- The pipeline produces per-scene MP4s as well as a final stitched property tour, typically final_property_tour_{PROPERTY_CODE}.mp4.
- The output folder is therefore the terminal artifact boundary for each batch run.
10. Usage tracking and observability
- API usage is logged to token_counter.csv.
- The log captures timestamp, property ID, process name, model, execution time, and token counts.
- This is a lightweight audit/finance subsystem rather than a monitoring stack, but it materially affects the architecture because every AI call is tracked.
11. Core helper responsibilities
- The README calls out helpers for packaging image data for Gemini and Veo, cleaning JSON-like AI responses, and recording API hits.
- These helpers act as adapters between local files and model-specific request formats.
- They are important because they isolate provider-specific input/output handling from the orchestration flow.
12. Operational model
- The repo is designed for batch execution per property, not interactive use.
- A typical run scans one property folder, generates all clips, then exits after writing outputs and logs.
- This makes the architecture easy to diagram as a single pipeline with clear stages and file-system checkpoints.
13. External dependencies that define the system
- Google Gemini and Veo are the critical external services; without them, the pipeline cannot classify images or generate clips.
- MoviePy is the local composition library that turns generated scenes into the final deliverable.
- Python 3.8+ is the runtime baseline.
14. Key architectural boundaries to show in a diagram
- Local filesystem boundary: images in, MP4s and CSV out.
- Cloud AI boundary: Gemini for labeling and Veo for clip generation.
- Local composition boundary: MoviePy stitching and duration control.
- These three boundaries define the repository’s architecture more accurately than individual functions do.
Main entry points: tourVision.py TourVision
Components 15
Local pipeline
Batch orchestration and filesystem-driven processing inside Python
- TourVision · Main batch entrypoint that drives one property tour run
tourVision.py - Runtime config · Property code, paths, durations, and model settings
tourVision.py - Env secrets · External API credentials such as GEMINI_API_KEY
- Image packager · Prepares local photos for Gemini requests
tourVision.py - Response cleaner · Normalizes JSON-like model responses into usable labels
tourVision.py - Room groups · Grouped images by detected room or scene label
tourVision.py - Scene picker · Chooses best images or pairs for each scene
tourVision.py - Veo prompts · Builds panorama or transition prompts from selected images
tourVision.py - MoviePy stitcher · Concatenates clips with crossfades and timing control
tourVision.py
Cloud AI
External model calls for image understanding and video generation
- Gemini Vision · Labels photos by room or scene type
- Veo generator · Generates cinematic clips from selected images
Artifacts
Input media, generated video, and usage logs
- Property photos · Source images under images/{PROPERTY_CODE}/
- Scene MP4s · Per-scene video outputs written before final assembly
- Final tour · Completed property tour video
- Token log · Records model usage, timing, and token counts
Connections 16
- Runtime config → TourVision: drive run · Supplies property, path, and timing settings
- Env secrets → TourVision: API key · Provides Gemini authentication
- Property photos → Image packager: load photos · Reads a property image batch for processing
- TourVision → Image packager: prepare input · Starts packaging images for classification
- Image packager → Gemini Vision: classify · Sends images to the vision model
- Gemini Vision → Response cleaner: raw labels · Returns structured or semi-structured label output
- Response cleaner → Room groups: normalize · Converts model output into room-based groups
- Room groups → Scene picker: select scenes · Feeds grouped images into selection logic
- Scene picker → Veo prompts: build prompts · Creates prompt strategy from chosen images
- Veo prompts → Veo generator: generate clip · Submits prompt and image context to Veo
- Veo generator → Scene MP4s: write clips · Stores generated per-scene MP4 artifacts
- Scene MP4s → MoviePy stitcher: assemble · Provides clips for final composition
- MoviePy stitcher → Final tour: export video · Writes the completed property tour MP4
- TourVision → Token log: record usage · Logs model calls, timing, and tokens
- Gemini Vision → Token log: audit call · Tracks classification usage
- Veo generator → Token log: audit call · Tracks video generation usage