Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add build workflow #1

Merged
merged 5 commits into from
Nov 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

name: Build

on:
push:
branches:
- main
pull_request:

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: 'stable'

- name: Install dependencies
run: dart pub get

- name: Check format
run: dart format --set-exit-if-changed lib/

- name: Analyze code
run: dart analyze lib/

- name: Build example app
run: |
cd example/
flutter build web --release
78 changes: 53 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,67 @@
<!--
This README describes the package. If you publish this package to pub.dev,
this README's contents appear on the landing page for your package.
# The fal.ai Dart/Flutter client

For information about how to write a good package README, see the guide for
[writing package pages](https://dart.dev/guides/libraries/writing-package-pages).
![fal_client pub.dev package](https://img.shields.io/pub/v/fal_client?color=%237527D7&label=fal_client&style=flat-square)
![Build](https://img.shields.io/github/actions/workflow/status/fal-ai/serverless-client-dart/build.yml?style=flat-square)
![License](https://img.shields.io/github/license/fal-ai/serverless-client-dart?style=flat-square)

For general information about developing packages, see the Dart guide for
[creating packages](https://dart.dev/guides/libraries/create-library-packages)
and the Flutter guide for
[developing packages and plugins](https://flutter.dev/developing-packages).
-->
## About the Project

TODO: Put a short description of the package here that helps potential users
know whether this package might be useful for them.
The `fal_client` is a robust and user-friendly library designed for seamless integration of fal serverless functions in Dart and Flutter projects. Developed in pure Dart, it provides developers with simple APIs to interact with AI models and works across all supported Flutter platforms.

## Features
## Getting Started

TODO: List what your package can do. Maybe include images, gifs, or videos.
The `fal_client` library serves as a client for fal serverless Python functions. For guidance on creating your functions, refer to the [quickstart guide](https://fal.ai/docs).

## Getting started
### Client Library

TODO: List prerequisites and provide or point to information on how to
start using the package.
This client library is crafted as a lightweight layer atop platform standards like `http` and `cross_file`. This ensures a hassle-free integration into your existing codebase. Moreover, it addresses platform disparities, guaranteeing flawless operation across various Flutter runtimes.

## Usage
> **Note:**
> Ensure you've reviewed the [fal-serverless getting started guide](https://fal.ai/docs) to acquire your credentials and register your functions.

TODO: Include short and useful examples for package users. Add longer examples
to `/example` folder.
1. Start by adding `fal_client` as a dependency:

```sh
flutter pub add fal_client
```

2. Setup the client instance:

```dart
import 'package:fal_client/client.dart';

final fal = FalClient.withCredentials("FAL_KEY_ID:FAL_KEY_SECRET");
```

3. Now use `fal.subcribe` to dispatch requests to the model API:

```dart
const like = 'sample';
final result = await fal.subscribe('text-to-image', input: {
'prompt': 'a cute shih-tzu puppy',
'model_name': 'stabilityai/stable-diffusion-xl-base-1.0',
});
```

## Additional information
The result type is a `Map<String, dynamic>` and the entries depend on the API output schema. Types in Python are mapped to their corresponding types in Dart. Check [fal.ai/models](https://fal.ai/models) for all available model APIs.

## Roadmap

See the [open feature requests](https://github.com/fal-ai/serverless-client-dart/labels/enhancement) for a list of proposed features and join the discussion.

## Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are **greatly appreciated**.

1. Make sure you read our [Code of Conduct](https://github.com/fal-ai/serverless-client-dart/blob/main/CODE_OF_CONDUCT.md)
2. Fork the project and clone your fork
3. Setup the local environment with `npm install`
4. Create a feature branch (`git checkout -b feature/add-cool-thing`) or a bugfix branch (`git checkout -b fix/smash-that-bug`)
5. Commit the changes (`git commit -m 'feat(client): added a cool thing'`) - use [conventional commits](https://conventionalcommits.org)
6. Push to the branch (`git push --set-upstream origin feature/add-cool-thing`)
7. Open a Pull Request

Check the [good first issue queue](https://github.com/fal-ai/serverless-client-dart/labels/good+first+issue), your contribution will be welcome!

## License

TODO: Tell users more about the package: where to find more information, how to
contribute to the package, how to file issues, what response they can expect
from the package authors, and more.
Distributed under the MIT License. See [LICENSE](https://github.com/fal-ai/serverless-client-dart/blob/main/LICENSE) for more information.
1 change: 0 additions & 1 deletion lib/runtime.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'package:cross_file/cross_file.dart';
import 'package:platform/platform.dart';

// In Dart, we can use the dart:html library to check for browser-specific features
Expand Down
6 changes: 0 additions & 6 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,10 @@ topics:

environment:
sdk: '>=3.1.5 <4.0.0'
flutter: '>=1.17.0'

dependencies:
cross_file: ^0.3.3+6
flutter:
sdk: flutter
http: ^1.1.0
platform: ^3.1.3

dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^2.0.0
Loading