Skip to content

Commit

Permalink
chore: reorg package exports
Browse files Browse the repository at this point in the history
  • Loading branch information
drochetti committed Nov 6, 2023
1 parent e4ff551 commit 2bf3449
Show file tree
Hide file tree
Showing 17 changed files with 19 additions and 12 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,25 @@ This client library is crafted as a lightweight layer atop platform standards li
2. Setup the client instance:

```dart
import 'package:fal_client/client.dart';
import "package:fal_client/client.dart";
final fal = FalClient.withCredentials('FAL_KEY_ID:FAL_KEY_SECRET');
final fal = FalClient.withCredentials("FAL_KEY_ID:FAL_KEY_SECRET");
```

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

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

**Notes:**

- Replace `text-to-image` with a valid model id. Check [fal.ai/models](https://fal.ai/models) for all available models.
- 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 (e.g. `str` -> `String`).

## Roadmap

Expand Down
6 changes: 4 additions & 2 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import 'package:fal_client/client.dart';
import 'package:fal_client/fal_client.dart';
import 'package:flutter/material.dart';

// You can use the proxyUrl to protect your credentials in production.
// final fal = FalClient.withProxy("http://localhost:3333/api/fal/proxy");

// You can also use the credentials locally for development, but make sure
// you protected your credentials behind a proxy in production.
final fal = FalClient.withCredentials("fal_key_id:fal_key_secret");
final fal = FalClient.withCredentials("FAL_KEY_ID:FAL_KEY_SECRET");

void main() {
runApp(const MyApp());
Expand Down Expand Up @@ -94,6 +94,8 @@ class _TextoToImageScreenState extends State<TextoToImageScreen> {
"prompt": _promptController.text,
"model_name": "stabilityai/stable-diffusion-xl-base-1.0",
"image_size": "square_hd"
}, onQueueUpdate: (update) => {
print(update)
});
setState(() {
_isLoading = false;
Expand Down
5 changes: 5 additions & 0 deletions lib/fal_client.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export 'src/client.dart';
export 'src/config.dart';
export 'src/exception.dart';
export 'src/queue.dart';
export 'src/storage.dart';
1 change: 0 additions & 1 deletion lib/runtime/version.dart

This file was deleted.

2 changes: 0 additions & 2 deletions lib/client.dart → lib/src/client.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
library fal_client;

import './config.dart';
import './exception.dart';
import './http.dart';
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions lib/src/runtime/version.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Note: temporary solution, should be replaced with something
// else that resolves the package version at build-time or runtime.
const packageVersion = '0.2.1';
File renamed without changes.
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: fal_client
description: >
The Dart client library for fal.ai model APIs.
You can use it to call multiple AI models on your Dart and Flutter apps.
version: 0.2.0
version: 0.2.1
homepage: https://fal.ai
repository: https://github.com/fal-ai/serverless-client-dart
issue_tracker: https://github.com/fal-ai/serverless-client-dart/issues?q=is%3Aissue+is%3Aopen
Expand Down

0 comments on commit 2bf3449

Please sign in to comment.