@umituz/react-native-ai-fal-provider 1.0.37 → 1.0.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-ai-fal-provider",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.39",
|
|
4
4
|
"description": "FAL AI provider for React Native - implements IAIProvider interface for unified AI generation",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -21,8 +21,8 @@ export const FAL_IMAGE_FEATURE_MODELS: Record<ImageFeatureType, string> = {
|
|
|
21
21
|
"upscale": "fal-ai/clarity-upscaler",
|
|
22
22
|
"photo-restore": "fal-ai/aura-sr",
|
|
23
23
|
"face-swap": "fal-ai/face-swap",
|
|
24
|
-
"anime-selfie": "fal-ai/flux/
|
|
25
|
-
"remove-background": "fal-ai/
|
|
24
|
+
"anime-selfie": "fal-ai/flux-pro/kontext",
|
|
25
|
+
"remove-background": "fal-ai/birefnet",
|
|
26
26
|
"remove-object": "fal-ai/flux-kontext-lora/inpaint",
|
|
27
27
|
"hd-touch-up": "fal-ai/clarity-upscaler",
|
|
28
28
|
"replace-background": "fal-ai/bria/background/replace",
|
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
buildRemoveBackgroundInput,
|
|
30
30
|
buildRemoveObjectInput,
|
|
31
31
|
buildReplaceBackgroundInput,
|
|
32
|
-
|
|
32
|
+
buildKontextStyleTransferInput,
|
|
33
33
|
buildVideoFromImageInput,
|
|
34
34
|
} from "../utils/input-builders.util";
|
|
35
35
|
|
|
@@ -213,12 +213,10 @@ export class FalProvider implements IAIProvider {
|
|
|
213
213
|
return buildReplaceBackgroundInput(imageBase64, { prompt, ...options });
|
|
214
214
|
|
|
215
215
|
case "anime-selfie":
|
|
216
|
-
return
|
|
217
|
-
prompt: prompt || (options?.prompt as string) ||
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
num_inference_steps: options?.num_inference_steps as number,
|
|
221
|
-
guidance_scale: options?.guidance_scale as number,
|
|
216
|
+
return buildKontextStyleTransferInput(imageBase64, {
|
|
217
|
+
prompt: prompt || (options?.prompt as string) ||
|
|
218
|
+
"Transform this person into anime style illustration. Keep the same gender, face structure, hair color, eye color, and expression. Make it look like a high-quality anime character portrait with vibrant colors and clean lineart.",
|
|
219
|
+
guidance_scale: (options?.guidance_scale as number) ?? 4.0,
|
|
222
220
|
});
|
|
223
221
|
|
|
224
222
|
default:
|
|
@@ -126,13 +126,19 @@ export function buildImageToImageInput(
|
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
/**
|
|
129
|
-
* Build remove background input for FAL
|
|
129
|
+
* Build remove background input for FAL birefnet
|
|
130
|
+
* Uses General Use (Light) model for fast processing
|
|
130
131
|
*/
|
|
131
132
|
export function buildRemoveBackgroundInput(
|
|
132
133
|
base64: string,
|
|
133
134
|
_options?: RemoveBackgroundOptions,
|
|
134
135
|
): Record<string, unknown> {
|
|
135
|
-
return buildSingleImageInput(base64
|
|
136
|
+
return buildSingleImageInput(base64, {
|
|
137
|
+
model: "General Use (Light)",
|
|
138
|
+
operating_resolution: "1024x1024",
|
|
139
|
+
output_format: "png",
|
|
140
|
+
refine_foreground: true,
|
|
141
|
+
});
|
|
136
142
|
}
|
|
137
143
|
|
|
138
144
|
/**
|
|
@@ -169,3 +175,22 @@ export function buildHDTouchUpInput(
|
|
|
169
175
|
): Record<string, unknown> {
|
|
170
176
|
return buildUpscaleInput(base64, options);
|
|
171
177
|
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Build Kontext style transfer input for FAL flux-pro/kontext
|
|
181
|
+
* Instruction-based editing that preserves character identity
|
|
182
|
+
*/
|
|
183
|
+
export interface KontextStyleTransferOptions {
|
|
184
|
+
prompt: string;
|
|
185
|
+
guidance_scale?: number;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
export function buildKontextStyleTransferInput(
|
|
189
|
+
base64: string,
|
|
190
|
+
options: KontextStyleTransferOptions,
|
|
191
|
+
): Record<string, unknown> {
|
|
192
|
+
return buildSingleImageInput(base64, {
|
|
193
|
+
prompt: options.prompt,
|
|
194
|
+
guidance_scale: options.guidance_scale ?? 3.5,
|
|
195
|
+
});
|
|
196
|
+
}
|