Skip to content

AnubhavChaturvedi-GitHub/flow-unofficial-api

Repository files navigation

Google Flow Image Generation Automation

Overview

This project provides an automated solution for Google Flow image generation with real-time progress tracking, using your existing Chrome profile for seamless integration.

Features

flow_automation.py (Main Automation Script)

  • Custom Chrome Profile: Uses your existing Chrome profile (from SeleniumProfile directory)
  • Interactive Prompt Input: Supports multiple prompts separated by |
  • Real-Time Progress: Shows visual progress bar during generation
  • Smart Fallback: Time-based progress if percentage detection fails
  • Error Handling: Comprehensive error recovery and logging
  • Download Management: Auto-organizes downloaded images
  • Anti-Detection Measures: Prevents Flow from detecting automation

diagnose_progress.py (Progress Indicator Diagnostics)

  • Progress Detection Debugger: Helps diagnose why progress percentage isn't showing
  • Visual Analysis: Captures and analyzes all progress-related elements
  • Detailed Logging: Records comprehensive debugging information
  • JSON Output: Structured data for easy analysis

scrape_flow.py (Page Structure Scraper)

  • Comprehensive Scraper: Captures full page structure information
  • Multi-Element Detection: Finds buttons, images, links, inputs, and more
  • JSON Output: Saves structured data for UI analysis

Setup

1. Install Dependencies

pip install -r requirements.txt

2. First Run (Profile Setup)

python flow_automation.py
  • Browser will open with your Chrome profile
  • Navigate to the image generation interface
  • The automation will wait for your input

Usage

Basic Usage

python flow_automation.py

Enter prompts and press Enter. Use | to separate multiple prompts.

Diagnose Progress Issues

python diagnose_progress.py
  • Browser opens with your profile
  • Navigate to generation interface and start generation
  • Press Enter when you see progress indicator
  • Results saved to progress_diagnosis.json and diagnose_progress.log

Advanced Testing

# Test progress display functionality
python test_progress_display.py

# Quick class verification
python -c \"from flow_automation import GoogleFlowAutomation; test = GoogleFlowAutomation(headless=True); print('✅ Class created successfully')\"

Files and Directories

Main Files

  • flow_automation.py: Main automation script
  • diagnose_progress.py: Progress indicator debugger
  • scrape_flow.py: Page structure analyzer
  • requirements.txt: Dependencies
  • README.md: This file

Generated Files

  • flow_automation.log: Automation log file
  • flow_scraper.log: Scraper log file
  • diagnose_progress.log: Progress diagnosis log
  • test_generation.log: Test generation log
  • flow_structure.json: Page structure data
  • progress_diagnosis.json: Progress indicator analysis
  • test_progress_display.py: Progress display tester

Directories

  • downloads/: Generated images (created automatically)
  • ~Library/Application Support/Google/Chrome/SeleniumProfile/: Your Chrome profile data

Troubleshooting

Issue: No Progress Percentage Display

  1. Run diagnostics:
    python diagnose_progress.py
  2. Start an image generation manually
  3. Press Enter in terminal when you see the progress indicator
  4. Check progress_diagnosis.json for analysis

Issue: Chrome Profile Not Loading

  1. Delete the SeleniumProfile directory
  2. Run flow_automation.py again to create new profile
  3. Or run with fresh profile:
    python -c \"import shutil; shutil.rmtree('/Users/anubhavchaturvedi/Library/Application Support/Google/Chrome/SeleniumProfile'); print('Profile removed - will create new one')\"

Issue: Downloaded Images Not Found

  • Check the downloads/ directory
  • Verify Chrome download settings in flow_automation.py

Performance Issues

  • Reduce --headless mode wait times
  • Adjust implicitly_wait in setup_driver()
  • Monitor browser console for errors

Advanced Customization

Custom Profile Path

Edit flow_automation.py:

self.profile_dir = os.path.expanduser(\"~/Library/Application Support/Google/Chrome/MyCustomProfile\")

Generation Settings

Modify in generate() method:

  • max_wait: Generation timeout (default: 300 seconds)
  • time.sleep() intervals
  • Progress bar appearance

Chrome Options

Add to setup_driver() in flow_automation.py:

chrome_options.add_argument(\"--your-option\")

Progress Detection Methods

The automation uses multiple methods to detect progress:

  1. Text search: Looks for elements containing "%" character
  2. Progress bars: Searches for elements with progress class or role
  3. Aria attributes: Checks aria-valuenow for numeric values
  4. Style attributes: Analyzes CSS styles for width percentages
  5. Time-based fallback: Linear progress estimate if no percentage detected

Browser Compatibility

  • Chrome only: Uses ChromeDriver
  • MacOS: Tested on Mojave and later
  • Windows/Linux: Chrome profile paths may need adjustment

License

MIT License - feel free to modify and distribute as needed.

Support

For issues or improvements:

  1. Check existing log files
  2. Run diagnostic tools
  3. Review page structure data
  4. Test with fresh Chrome profile

About

Google Flow Image Generation Automation with Selenium

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages