嗖嘎AI视频生成器:PyQt6 桌面端,支持批量图片/视频生成
Project description
AI Tools - Image & Video Generation
A comprehensive desktop application for AI-powered image and video generation with batch processing capabilities. Built with PyQt6, Peewee ORM, and managed with uv.
Features
- Image Generation: Generate images using Google Nano Banana API
- Video Generation: Create videos using OpenAI Sora2 API with text and optional image inputs
- Batch Processing: Process multiple prompts simultaneously
- Task Management: Track progress and manage generation tasks
- Database Storage: SQLite database for persistent task history
- User-Friendly Interface: Modern PyQt6-based GUI
Requirements
- Python 3.8+
- uv (Python package manager)
- API Keys for Google Nano Banana and OpenAI Sora2
Installation
1. Install uv (if not already installed)
curl -LsSf https://astral.sh/uv/install.sh | sh
2. Clone and Setup Project
git clone <repository-url>
cd ai-tools
3. Install Dependencies
uv pip install -e .
4. Configure API Keys
Copy the example environment file and add your API keys:
cp .env.example .env
Edit .env file with your API keys:
# Google API Key for Nano Banana image generation
GOOGLE_API_KEY=your_google_api_key_here
# OpenAI API Key for Sora2 video generation
OPENAI_API_KEY=your_openai_api_key_here
# Optional: API Endpoints (defaults will be used if not set)
GOOGLE_NANO_BANANA_ENDPOINT=https://api.google.com/nano-banana/v1/generate
OPENAI_SORA2_ENDPOINT=https://api.openai.com/v1/video/generations
# Batch processing settings
MAX_BATCH_SIZE=10
MAX_CONCURRENT_TASKS=3
Usage
Run the Application
uv run ai-tools
Or directly:
python -m ai_tools.main
Image Generation
- Navigate to the "Image Generation" tab
- Enter your prompt in the text area
- For batch processing:
- Check "Enable Batch Processing"
- Enter multiple prompts (one per line)
- Or load prompts from a text file
- Click "Generate Image(s)"
- Monitor progress and view results
Video Generation
- Navigate to the "Video Generation" tab
- Enter your text prompt
- Optionally select an input image for image-to-video generation
- Configure video settings (duration, FPS, resolution)
- For batch processing:
- Check "Enable Batch Processing"
- Enter multiple prompts
- Click "Generate Video(s)"
Batch Management
- Navigate to the "Batch Manager" tab
- View all batch jobs and their status
- Cancel or delete batches as needed
- View individual tasks within each batch
Task History
- Navigate to the "Task History" tab
- Filter tasks by type, status, or date range
- View output files
- Retry failed or cancelled tasks
- Delete unwanted tasks
Project Structure
ai-tools/
├── src/
│ └── ai_tools/
│ ├── __init__.py
│ ├── main.py # Application entry point
│ ├── config.py # Configuration management
│ ├── database.py # Database models and operations
│ ├── ui/ # User interface components
│ │ ├── main_window.py # Main application window
│ │ ├── image_generation_tab.py
│ │ ├── video_generation_tab.py
│ │ ├── batch_manager_tab.py
│ │ ├── task_history_tab.py
│ │ └── workers.py # Background worker threads
│ └── generators/ # AI generation modules
│ ├── image_generator.py
│ └── video_generator.py
├── pyproject.toml # Project configuration
├── .env.example # Environment variables template
└── README.md
API Integration
Google Nano Banana API
Used for image generation. Requires a valid Google API key.
Features:
- Text-to-image generation
- Configurable image dimensions
- Batch processing support
OpenAI Sora2 API
Used for video generation. Requires a valid OpenAI API key.
Features:
- Text-to-video generation
- Image-to-video generation (with optional input image)
- Configurable duration, FPS, and resolution
- Batch processing support
Database Schema
The application uses SQLite with the following main tables:
- tasks: Individual generation tasks
- batches: Groups of related tasks
- batch_tasks: Junction table for batch-task relationships
Configuration
Configuration is managed through environment variables and the config.py module:
- API keys and endpoints
- Batch processing limits
- Output directory settings
- UI preferences
Error Handling
The application includes comprehensive error handling:
- API connection failures
- Invalid API keys
- File system errors
- Database operations
- Network timeouts
Troubleshooting
Common Issues
- Missing API Keys: Ensure your
.envfile contains valid API keys - Database Errors: Check write permissions in the output directory
- Network Issues: Verify internet connectivity and API endpoint availability
- Memory Issues: Reduce batch size for large processing jobs
Logs and Debugging
The application logs detailed information about:
- API requests and responses
- Database operations
- File system operations
- Error conditions
Check the console output for detailed error messages.
Development
Adding New Features
- Update the database schema if needed
- Add new UI components in the
ui/directory - Implement generation logic in the
generators/directory - Update configuration in
config.py - Add appropriate error handling
Testing
# Run the application
uv run ai-tools
# Test image generation
# Test video generation
# Test batch processing
# Verify database operations
License
MIT License - see LICENSE file for details.
Support
For issues and feature requests, please use the GitHub issue tracker.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file souga_ai_video-0.1.0.tar.gz.
File metadata
- Download URL: souga_ai_video-0.1.0.tar.gz
- Upload date:
- Size: 23.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5b3b54177798b3245bd96162afcd7ebceefb46a27832062f04666812e7966009
|
|
| MD5 |
20b5860b77b73914c6556d64ffbe4d9e
|
|
| BLAKE2b-256 |
e82fb0365c68ca58e888bf30f263be65cddc29856d19c19b634ebad9ac792ca9
|
File details
Details for the file souga_ai_video-0.1.0-py3-none-any.whl.
File metadata
- Download URL: souga_ai_video-0.1.0-py3-none-any.whl
- Upload date:
- Size: 32.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1e6e92d905bc132b32640830b436de5a40a261bc4335a93683a6b38563e49bfd
|
|
| MD5 |
151d3219ee23e5c054f179922386f88a
|
|
| BLAKE2b-256 |
53bc12fdf801240c427013fc100bc975df70444b3c06a16694eceee068c1ba7b
|