This repository contains two complementary projects for housing analysis and accessibility assessment:
A comprehensive Python application that scrapes property images from Zillow listings and stores them in organized S3 buckets. Features both a command-line interface and a modern web application.
- β Smart Image Extraction - Finds all unique property images from Zillow listings
- β S3 Integration - Automatically uploads images to organized S3 folders
- β Web Interface - Modern, responsive web application
- β High-Quality Images - Downloads highest resolution available (1536px)
- β Duplicate Filtering - Removes duplicate images across different resolutions
- β Error Handling - Graceful handling of network issues and missing data
- π¨ Modern UI - Bootstrap-based responsive design
- π± Mobile Friendly - Works on all device sizes
- πΌοΈ Image Gallery - Beautiful gallery view with modal lightbox
- π Copy URLs - Easy copying of S3 URLs to clipboard
- β¬οΈ Bulk Download - Download all images at once
- π Statistics - View image counts and processing status
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β Web Frontend ββββββ Flask API ββββββ S3 Storage β
β (HTML/JS) β β (Python) β β (AWS) β
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β
βΌ
ββββββββββββββββββββ
β Zillow Scraper β
β (Core Logic) β
ββββββββββββββββββββ
- Start the web server
python app.py- Open your browser
http://localhost:5000
- Enter a Zillow URL and click "Extract Images"
# Basic usage
python zillow_image_scraper.py "https://www.zillow.com/homedetails/123-Main-St-San-Jose-CA-95112/123456_zpid/"
# Upload to S3
python zillow_image_scraper.py "https://www.zillow.com/homedetails/123-Main-St-San-Jose-CA-95112/123456_zpid/" --s3
# Download locally
python zillow_image_scraper.py "https://www.zillow.com/homedetails/123-Main-St-San-Jose-CA-95112/123456_zpid/" --downloadA Python-based AWS Lambda backend system for analyzing home environments and providing accessibility recommendations using Amazon Rekognition and Amazon Bedrock.
This backend system consists of two main Lambda functions that work together to analyze home images and generate accessibility recommendations:
- Purpose: Processes images using Amazon Rekognition to detect objects, labels, and accessibility features
- Input: S3 bucket and key for image location
- Output: Analysis results including detected objects, accessibility features, and potential barriers
- Key Features:
- Object detection and labeling
- Accessibility feature identification
- Barrier detection
- Accessibility scoring
- Purpose: Uses Amazon Bedrock to generate intelligent recommendations based on Rekognition analysis
- Input: Rekognition analysis results and image metadata
- Output: Structured recommendations and improvement suggestions
- Key Features:
- AI-powered accessibility recommendations
- Improvement suggestions with priority levels
- Cost and implementation difficulty estimates
aws/
βββ lambdas/
β βββ rekognition_handler/
β β βββ lambda_function.py # Rekognition Lambda handler
β βββ llm_handler/
β βββ lambda_function.py # LLM Lambda handler
βββ utils/
β βββ __init__.py
β βββ logger.py # Logging utility
β βββ image_processor.py # Image processing utilities
β βββ bedrock_client.py # Bedrock LLM client
βββ tests/
β βββ __init__.py
β βββ test_rekognition_handler.py
β βββ test_llm_handler.py
β βββ test_image_processor.py
β βββ test_bedrock_client.py
βββ requirements.txt # Python dependencies
βββ env.example # Environment variables template
βββ README.md # This file
- Object Detection: Identifies furniture, fixtures, and architectural elements
- Label Detection: Recognizes accessibility-related features and barriers
- Custom Analysis: Analyzes images for accessibility compliance
- Claude 3 Sonnet: Large Language Model for generating recommendations
- Structured Output: JSON-formatted recommendations and suggestions
- Context-Aware: Uses Rekognition results to provide relevant advice
- Image Storage: Stores uploaded home images for analysis
- Lambda Integration: Provides images to Lambda functions
- Image Upload: User uploads home image to S3
- Rekognition Analysis: First Lambda processes image with Amazon Rekognition
- LLM Processing: Second Lambda generates recommendations using Bedrock
- Response: Structured recommendations returned to client
Run tests using pytest:
# Install test dependencies
pip install pytest pytest-mock
# Run all tests
pytest tests/
# Run specific test file
pytest tests/test_rekognition_handler.py
# Run with verbose output
pytest -v tests/- Python 3.9+ (for Zillow scraper) / Python 3.11 (for Lambda backend)
- AWS Account with S3 access
- AWS credentials configured
- Docker (for local development)
- AWS SAM CLI (for deployment)
- Clone the repository
git clone https://github.com/G-Krishna-chandra/housingA.git
cd housingA- Install dependencies
# Install Python dependencies
pip install -r requirements.txt
# Install development dependencies
pip install pytest pytest-mock moto boto3
# Or use the Makefile
make install- Configure AWS credentials
# Option 1: AWS CLI
aws configure
# Option 2: Environment variables
export AWS_ACCESS_KEY_ID=your_access_key
export AWS_SECRET_ACCESS_KEY=your_secret_key
export AWS_DEFAULT_REGION=us-east-1- Set up environment variables
cp env.example .env
# Edit .env with your configuration# Set up development environment
make dev-setup
# Run all tests
make test
# Start local API Gateway
make start-api# Run all tests
make test
# Run unit tests only
make test-unit
# Run local testing script
make test-local
# Test individual functions
make test-presigned
make test-rekognition
make test-llm
make test-orchestrator
# Test API endpoints
make test-api# Start LocalStack for local AWS services
make setup-localstack
# Or manually with Docker Compose
docker-compose up -d localstack
# Check LocalStack status
curl http://localhost:4566/health# Test individual Lambda functions
python test_local.py --test
# Test specific function
python test_local.py --function presigned
python test_local.py --function rekognition
python test_local.py --function llm
python test_local.py --function orchestrator
# Simulate API calls
python test_local.py --simulate# Start local API Gateway
make start-api
# Test endpoints
curl -X POST http://localhost:3000/presigned-url \
-H "Content-Type: application/json" \
-d '{"filename": "test.jpg", "content_type": "image/jpeg"}'
curl -X POST http://localhost:3000/analyze \
-H "Content-Type: application/json" \
-d '{"images": [{"bucket": "test", "key": "test.jpg"}]}'# Show all available commands
make help
# Setup & Installation
make install # Install Python dependencies
make setup-localstack # Start LocalStack for local AWS simulation
make dev-setup # Complete development environment setup
# Testing
make test # Run all tests (unit + local)
make test-unit # Run unit tests with pytest
make test-local # Run local testing script
make test-presigned # Test Presigned URL function
make test-rekognition # Test Rekognition function
make test-llm # Test LLM function
make test-orchestrator # Test Orchestrator function
make test-api # Test API endpoints
# Development
make invoke-local # Test individual Lambda functions locally
make start-api # Start local API Gateway
make clean # Clean up temporary files
# Deployment
make build # Build SAM application
make deploy # Deploy to AWS using SAM
make deploy-dev # Deploy to dev environment
make deploy-prod # Deploy to prod environment
# Docker
make docker-up # Start all Docker services
make docker-down # Stop all Docker services
make docker-logs # Show Docker logs# Build and start the application
docker-compose up --build
# Run in background
docker-compose up -dAWS_ACCESS_KEY_ID- Your AWS access keyAWS_SECRET_ACCESS_KEY- Your AWS secret keyAWS_DEFAULT_REGION- AWS region (default: us-east-1)S3_BUCKET_NAME- S3 bucket name (default: zillow-images)BEDROCK_MODEL_ID- Bedrock model ID for Lambda backendFLASK_ENV- Flask environment (development/production)SECRET_KEY- Flask secret key for sessionsPORT- Server port (default: 5000)
Images are stored in S3 with the following structure:
your-bucket/
βββ listings/
β βββ zpid_123456/
β β βββ image_001.jpg
β β βββ image_002.webp
β β βββ ...
β βββ zpid_789012/
β β βββ image_001.jpg
β β βββ ...
β βββ ...
GET /- Main application pageGET /gallery/<job_id>- View image galleryGET /status/<job_id>- Check processing statusGET /results/<job_id>- Get detailed results
POST /process- Process a Zillow URL{ "url": "https://www.zillow.com/homedetails/..." }
- URL Validation - Ensures the URL is a valid Zillow listing
- Page Fetching - Downloads the listing page with browser-like headers
- Image Discovery - Multiple methods to find images:
- JSON data extraction
- HTML parsing
- Pattern matching
- Deduplication - Removes duplicate images across resolutions
- S3 Upload - Organizes and uploads images to S3
- Results - Returns organized image URLs and metadata
- Image Analysis - Amazon Rekognition analyzes uploaded images
- Feature Detection - Identifies accessibility features and barriers
- AI Recommendations - Amazon Bedrock generates intelligent suggestions
- Structured Output - Returns prioritized recommendations and improvements
Both applications handle various error conditions:
- Invalid URLs
- Network connectivity issues
- Missing AWS credentials
- S3 upload failures
- Malformed image data
- Rate limiting
- Processing Time: Typically 10-30 seconds per listing
- Image Quality: 1536px resolution (highest available)
- Storage: Organized by listing ID in S3
- Scalability: Handles multiple concurrent requests
- AWS IAM credentials for S3 access
- Input validation for URLs
- Error message sanitization
- Rate limiting protection
This project is open source and available under the MIT License.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
For issues and questions:
- Check the error messages in the web interface
- Review the command-line output for detailed error information
- Ensure AWS credentials are properly configured
- Verify S3 bucket permissions