A modern iOS application built with SwiftUI that generates AI-powered images from text descriptions using the Hugging Face API. ImaginAI transforms your imagination into visual reality through advanced machine learning models.
- 🤖 AI-Powered Image Generation: Create unique images from text descriptions using the FLUX.1-dev model
- 📱 Modern SwiftUI Interface: Clean, intuitive user experience with native iOS design patterns
- 🖼️ Image History: Browse and manage previously generated images
- 💾 Save to Photos: One-tap save functionality for generated images
- ⚡ Real-time Generation: Live progress indicators and status updates
- 🎯 Detail View: Full-screen image viewing with tap-to-save functionality
- 🔄 Smart State Management: Efficient handling of loading states and error conditions
- Framework: SwiftUI 3.0+
- Language: Swift 5.9
- Target: iOS 15.0+
- API: Hugging Face Inference API
- Architecture: MVVM with async/await patterns
- Image Processing: UIKit integration for image handling
[Screenshots would be added here]
- Xcode 15.0 or later
- iOS 15.0+ device or simulator
- Active internet connection for API calls
-
Clone the repository
git clone https://github.com/abrahao-dev/imaginAI.git cd imaginAI
-
Open in Xcode
open ImaginAI.xcodeproj
-
Build and Run
- Select your target device or simulator
- Press
Cmd + R
or click the Run button - The app will launch and be ready to generate images
The app uses the Hugging Face Inference API with the FLUX.1-dev model. The API key is currently embedded in the code for demonstration purposes. For production use, consider:
- Moving the API key to a secure configuration file
- Implementing proper key management
- Adding rate limiting and error handling
-
Enter Description: Type a detailed description of the image you want to generate
- Example: "A futuristic cityscape with flying cars and neon lights"
- Maximum 200 characters for optimal results
-
Generate Image: Tap "Gerar Imagem" to start the generation process
- Generation typically takes 30 seconds to 2 minutes
- Progress indicator shows current status
-
View Results: The generated image appears with options to:
- Save to photo album (tap the image)
- View in detail view (tap images in history)
- Generate new images (confirmation dialog prevents accidental overwrites)
-
Browse History: Scroll through previously generated images in the horizontal gallery
ImaginAI/
├── ImaginAIApp.swift # App entry point
├── ContentView.swift # Main UI and business logic
├── ImageGeneratorService.swift # API service layer
├── Assets.xcassets/ # App icons and colors
└── Info.plist # App configuration
ContentView
: Main SwiftUI view with MVVM architectureImageGeneratorService
: Handles API communication and image processingImageSaver
: Manages photo album integrationImageDetailView
: Full-screen image viewing component
- Model: Image data and API responses
- View: SwiftUI views with reactive UI updates
- ViewModel: State management in ContentView
- Modern concurrency patterns for API calls
- Proper error handling and user feedback
- Background processing with UI updates
- Reactive state management with
@State
properties - Proper view composition and reusability
- Native iOS design patterns and accessibility
The app implements comprehensive error handling:
- Network Errors: Connection issues and API failures
- Input Validation: Empty descriptions and character limits
- Image Processing: Data conversion and format issues
- User Feedback: Clear error messages and recovery options
- Image Caching: Generated images stored in memory for quick access
- API Optimization: Efficient request handling with proper timeouts
- Memory Management: Automatic cleanup of large image data
- UI Responsiveness: Background processing with loading indicators
- API key is currently embedded in source code (demo purposes only)
- No sensitive data is stored locally
- Network requests use HTTPS
- Input sanitization prevents injection attacks
We welcome contributions! Please follow these steps:
- Fork the repository
- Create a 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
- Follow Swift style guidelines
- Add comments for complex logic
- Test on multiple iOS versions
- Ensure accessibility compliance
This project is licensed under the MIT License - see the LICENSE file for details.
Matheus Abrahão
- GitHub: @abrahao-dev
- LinkedIn: linkedin.com/in/matheusabrahao
- Portfolio: matheusabrahao.com.br
- Hugging Face for providing the FLUX.1-dev model
- SwiftUI for the modern UI framework
- Apple Developer Documentation for comprehensive guides
- User authentication and cloud sync
- Multiple AI model support
- Image editing and filters
- Social sharing features
- Offline mode with cached images
- Advanced prompt templates
- Batch image generation
- Custom model fine-tuning
⭐ Star this repository if you found it helpful!