https://github.com/joshuadeguzman/stability-sdk-dart
An implementation of Stability AI SDK in Dart. Stability AI is a solution studio dedicated to innovating ideas.
https://github.com/joshuadeguzman/stability-sdk-dart
dart flutter stability-ai stable-diffusion
Last synced: 3 months ago
JSON representation
An implementation of Stability AI SDK in Dart. Stability AI is a solution studio dedicated to innovating ideas.
- Host: GitHub
- URL: https://github.com/joshuadeguzman/stability-sdk-dart
- Owner: joshuadeguzman
- License: bsd-3-clause
- Created: 2023-01-16T04:25:35.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-02-03T04:59:05.000Z (about 2 years ago)
- Last Synced: 2024-11-10T02:34:12.399Z (3 months ago)
- Topics: dart, flutter, stability-ai, stable-diffusion
- Language: Dart
- Homepage: https://pub.dev/packages/stability_sdk
- Size: 8.98 MB
- Stars: 18
- Watchers: 3
- Forks: 6
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-stable-diffusion - stability sdk
README
# stability_sdk
An implementation of [Stability AI](https://platform.stability.ai/) SDK in Dart. Stability AI is a solution studio dedicated to innovating ideas.
### Brush AI
A demonstrable use of stability SDK in Flutter and Dart.

*and more sample outputs...*
**Dogs**
"generate an oil painting canvas of a dog, realistic, painted by Leonardo da Vinci"
|Output 1|Output 2|Output 3|
|---|---|---|
|||**Cats**
"generate an oil painting canvas of a cat, realistic, painted by Leonardo da Vinci"
|Output 1|Output 2|Output 3|
|---|---|---|
|||**Cyberpunk**
"generate a cyberpunk scene, in japan, realistic street scene on the night"
|Output 1|Output 2|Output 3|
|---|---|---|
|||## Features
* [x] Text-to-image
Upcoming
* [ ] Image-to-image
* [ ] Inpainting + Masking
* [ ] CLIP guidance
* [ ] Multi-prompting## Setup
### Prerequisites
* Stability AI requires you to create your own API key to make calls to the API. You can create one [here](https://platform.stability.ai/docs/getting-started/authentication).
* Create a `.env` file and set your Stability AI API key
### Usage
The example provided is using the SDK directly in a Flutter app. In most cases, you're going to use the SDK in the backend using tools like [Dart Frog](https://pub.dev/packages/dart_frog). This is to secure the API key and to have more control of the incoming requests, e.g. controlling rate limits or blocking sensitive content.
```dart
// 1. Setup the API client
final client = StabilityApiClient.init("");// 2. Create a generation request
final request = RequestBuilder("an oil painting of a dog in the canvas, wearing knight armor, realistic painting by Leonardo da Vinci")
.setHeight(512)
.setWidth(512)
.setEngineType(EngineType.inpainting_v2_0)
.setSampleCount(1)
.build();// 3. Subscribe to the response
client.generate(request).listen((answer) {
image = answer.artifacts?.first.getImage();
});```
## ConnectLet's connect on [@joshuamdeguzman](https://twitter.com/joshuadeguzman).
## License
[BSD 3-Clause](https://github.com/joshuadeguzman/stability_sdk/blob/main/.github/LICENSE.md)