/KMM-Stable-Diffusion

Compose Multiplatform app generates images using Stability AI

Primary LanguageKotlinApache License 2.0Apache-2.0

KMP-Stable-Diffusion

Github - viethua99 License Github - viethua99 Linkedin - viethua99

-----------------------------------------------------

Supporters

Stargazers repo roster for @viethua99/KMP-Stable-Diffusion

Demo Video

IMAGE ALT TEXT HERE

Features

Stable Diffusion

Text To Image Image To Image

Others Feature

Save Locally Dark / Light Mode
Expand to see supported styles
Style Sample Style Sample
Anime Origami
3D Model Line Art
Photographic Analog Film
Comic Book Cinematic
Pixel Art Isometric
Neon Punk Low Poly
Fantasy Art Tile Texture
Digital Art

Screenshots

Android

iOS

Setup

Stability AI

This project using the Stability AI API for constructing RESTful API. Stability AI provides a RESTful API interface to highly detailed objects built from thousands of lines of data related to text to images.

  • Step 1: Create an account and generate an API key at Stability AI

  • Step 2: Paste the API key to your project gradle.properties file:

STABLE_DIFFUSION_API_KEY=YOUR_API_KEY_HERE
  • Step 3: Sync project and run your app

Android

Select composeApp configuration and run the project.

iOS

Select iOSApp configuration and run the project.

Technical Dependencies

Project Structure

Common Structure

├── composeApp
│   ├── androidMain
│   ├── commonMain
│   │   ├── kotlin/com/vproject/stablediffusion
│   │   │   ├── database
│   │   │   │   ├── dao                                      <––– Data Access Object (DAOs)
│   │   │   │   └── ...
│   │   │   ├── di                                           <––– Koin Depedenency Injection package
│   │   │   ├── model
│   │   │   ├── network
│   │   │   │    ├── StableDiffusionApi.kt                   <––– RESTFul APIs
│   │   │   │    └── ...
│   │   │   ├── presentation
│   │   │   │   ├── component
│   │   │   │   ├── screen
│   │   │   │   │   ├── generate                             <––– Generate Screen package
│   │   │   │   │   │   ├── GenerateScreen.kt                <––– Composable Generate Screen UIs
│   │   │   │   │   │   ├── GenerateModel.kt                 <––– Generate Screen View Model
│   │   │   │   │   │   └── GenerateUiState.kt               <––– Generate Sealed class UI State
│   │   │   │   │   └── ...
│   │   │   ├── repository
│   │   │   │   ├── ImageRepository.kt                       <––– Image repository to send requests
│   │   │   │   └── ...
│   │   │   └── util
│   │   ├── resources                                        <––– Moko Resources to store local images and strings
│   │   └── sqldelight/com/vproject/stablediffusion          <––– Local database entities
│   ├── desktopMain
│   └── iosMain
└── ...

System Design

System Design

Download

Go to the Releases to download the latest APK version.

License

KMP-Stable-Diffusion is distributed under the terms of the Apache License (Version 2.0). See the license for more information.