An advanced web application that generates unique t-shirt designs using Stable Diffusion 3.5 and Hugging Face API. Create custom t-shirt designs with AI, preview them in real-time, and manage your online store.
- Dual AI Design Generation:
- Primary: Hugging Face Stable Diffusion API
- Fallback: Local Stable Diffusion Worker
- Real-time Preview: Instant visualization of generated designs
- Custom Design Interface: User-friendly prompt-based design creation
- E-commerce Integration: Complete shopping cart and checkout system
- Responsive Design: Works seamlessly on desktop and mobile devices
- Cross-Platform Support: Runs on both Windows and Ubuntu ARM
- Windows 10 or later
- Python 3.12+
- Node.js 18+ and npm
- Git installed
- Ubuntu 20.04+ on ARM architecture
- Python 3.8+
- Node.js 18+ and npm
- Git installed
- Clone the repository:
git clone https://github.com/rastinder/auto-tshirt-designer1.git
cd auto-tshirt-designer1- Set up Python virtual environment:
python -m venv venv
venv\Scripts\activate
cd server
pip install -r requirements.txt
cd ..- Install frontend dependencies:
npm install- Start the development servers:
# Start both frontend and backend
start.bat- Clone and setup:
cd ~
git clone https://github.com/rastinder/auto-tshirt-designer1.git
cd auto-tshirt-designer1
chmod +x deploy.sh
./deploy.sh- Or use the one-click installation:
pm2 delete all && cd ~ && sudo rm -rf auto-tshirt-designer1 && git clone https://github.com/rastinder/auto-tshirt-designer1.git && cd auto-tshirt-designer1 && chmod +x deploy.sh && ./deploy.shThe worker is a fallback system that generates images when the Hugging Face API is unavailable.
setup_worker_gpu.batchmod +x setup_worker_gpu.sh && ./setup_worker_gpu.sh- Modern React with TypeScript
- Tailwind CSS for styling
- Real-time design preview
- Shopping cart system
- Responsive components
- Primary image generation via Hugging Face API
- Fallback to local worker if API fails
- RESTful API endpoints
- WebSocket support for workers
- Cross-platform path handling
- Robust error handling and logging
.
βββ src/ # Frontend source
β βββ components/ # React components
β βββ pages/ # Page components
β βββ utils/ # Utility functions
βββ server/ # FastAPI backend
β βββ main.py # Server entry point
β βββ task_queue.py # Task management
β βββ requirements.txt # Python dependencies
βββ outputs/ # Generated images
βββ logs/ # Server logs
βββ worker/ # Stable Diffusion worker (fallback)
POST /design- Create new design{ "prompt": "A cosmic galaxy pattern", "style": "realistic", "negative_prompt": "blurry, distorted, low quality", "priority": 1 }GET /status/{task_id}- Check design statusGET /images/{image_name}- Retrieve generated imagesWS /ws- WebSocket connection for workers
Create a .env file in the server directory:
HOST=0.0.0.0
PORT=8000
HF_API_KEY=your_huggingface_api_keyAccess the test dashboard at https://aitshirts.in/test for a visual interface showing:
- System Status
- Worker Status
- Queue Information
- Available Test Endpoints
- Test Results
curl https://aitshirts.in/testcurl https://aitshirts.in/test/run-allHealth Check:
curl https://aitshirts.in/api/test/healthDesign Generation Test:
curl -X POST https://aitshirts.in/api/test/design \
-H "Content-Type: application/json" \
-d '{"prompt": "test design", "test_mode": true}'Background Removal Test:
curl -X POST https://aitshirts.in/api/test/background-removal \
-H "Content-Type: application/json" \
-d '{"image_url": "https://example.com/image.png", "test_mode": true}'Worker Status:
curl https://aitshirts.in/api/test/workers{
"status": "ok",
"timestamp": "2024-01-20T12:00:00Z"
}{
"workers": {
"connected": 2,
"ids": ["worker1", "worker2"]
},
"queue": {
"size": 0,
"pending": 0,
"processing": 0
}
}{
"status": "success",
"task_id": "test-123",
"result": {
"image_url": "/images/test-image.png",
"metadata": {
"prompt": "test design",
"test": true
}
}
}For Windows users, run the test script:
cd server
test_full_api.batFor PowerShell users (detailed output):
cd server
.\test_full_api.ps1# Start development servers
start.bat
# Start worker (optional)
worker\start_worker.bat# Start production servers
./deploy.sh
# Start worker (optional)
./worker/start_worker.shLogs are stored in the logs directory:
- Server logs:
logs/server.log - Access logs: Generated by Uvicorn
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Hugging Face for the Stable Diffusion API
- FastAPI for the backend framework
- React for the frontend framework
- Tailwind CSS for styling
Rastinder - GitHub
Project Link: https://github.com/rastinder/auto-tshirt-designer1