@umituz/react-native-ai-generation-content 1.17.194 → 1.17.196
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,13 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Couple Future Types
|
|
3
|
-
*
|
|
3
|
+
* Multi-reference image generation for couples using FLUX.2 Flex
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
export interface CoupleFutureInput {
|
|
7
7
|
partnerABase64: string;
|
|
8
8
|
partnerBBase64: string;
|
|
9
9
|
prompt: string;
|
|
10
|
-
negativePrompt?: string;
|
|
11
10
|
}
|
|
12
11
|
|
|
13
12
|
export interface CoupleFutureConfig {
|
|
@@ -23,9 +22,9 @@ export interface CoupleFutureResult {
|
|
|
23
22
|
}
|
|
24
23
|
|
|
25
24
|
export const COUPLE_FUTURE_DEFAULTS = {
|
|
26
|
-
model: "fal-ai/
|
|
27
|
-
negativePrompt: "ugly, deformed, blurry, low quality, watermark, text",
|
|
25
|
+
model: "fal-ai/flux-2-flex/edit",
|
|
28
26
|
imageSize: "landscape_4_3" as const,
|
|
29
27
|
timeoutMs: 300000,
|
|
30
|
-
|
|
28
|
+
numInferenceSteps: 28,
|
|
29
|
+
guidanceScale: 3.5,
|
|
31
30
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Couple Future Executor
|
|
3
|
-
*
|
|
3
|
+
* Multi-reference image generation using FLUX.2 Flex
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { providerRegistry } from "../../../infrastructure/services/provider-registry.service";
|
|
@@ -29,39 +29,52 @@ export async function executeCoupleFuture(
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
const { onProgress, timeoutMs, imageSize } = config ?? {};
|
|
32
|
+
let lastStatus = "";
|
|
32
33
|
|
|
33
34
|
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
34
|
-
console.log("[CoupleFuture] Starting generation");
|
|
35
|
+
console.log("[CoupleFuture] Starting FLUX.2 Flex generation");
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
try {
|
|
38
39
|
onProgress?.(5);
|
|
39
40
|
|
|
40
|
-
const
|
|
41
|
+
const imageUrls = [input.partnerABase64, input.partnerBBase64]
|
|
41
42
|
.filter(Boolean)
|
|
42
|
-
.map(
|
|
43
|
+
.map(formatBase64);
|
|
43
44
|
|
|
44
|
-
if (
|
|
45
|
-
return { success: false, error: "
|
|
45
|
+
if (imageUrls.length < 2) {
|
|
46
|
+
return { success: false, error: "Two reference images required" };
|
|
46
47
|
}
|
|
47
48
|
|
|
48
49
|
onProgress?.(10);
|
|
49
50
|
|
|
51
|
+
// Enhance prompt to reference both images
|
|
52
|
+
const enhancedPrompt = `A photorealistic image of a couple. The first person @image1 and the second person @image2. ${input.prompt}. High quality, detailed, professional photography.`;
|
|
53
|
+
|
|
50
54
|
const modelInput = {
|
|
51
|
-
|
|
52
|
-
prompt:
|
|
53
|
-
negative_prompt: input.negativePrompt || COUPLE_FUTURE_DEFAULTS.negativePrompt,
|
|
54
|
-
num_images: 1,
|
|
55
|
+
image_urls: imageUrls,
|
|
56
|
+
prompt: enhancedPrompt,
|
|
55
57
|
image_size: imageSize || COUPLE_FUTURE_DEFAULTS.imageSize,
|
|
56
|
-
|
|
58
|
+
num_inference_steps: COUPLE_FUTURE_DEFAULTS.numInferenceSteps,
|
|
59
|
+
guidance_scale: COUPLE_FUTURE_DEFAULTS.guidanceScale,
|
|
60
|
+
output_format: "jpeg",
|
|
61
|
+
enable_safety_checker: true,
|
|
57
62
|
};
|
|
58
63
|
|
|
64
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
65
|
+
console.log("[CoupleFuture] Prompt:", enhancedPrompt);
|
|
66
|
+
}
|
|
67
|
+
|
|
59
68
|
const result = await provider.subscribe(COUPLE_FUTURE_DEFAULTS.model, modelInput, {
|
|
60
69
|
timeoutMs: timeoutMs || COUPLE_FUTURE_DEFAULTS.timeoutMs,
|
|
61
70
|
onQueueUpdate: (status) => {
|
|
71
|
+
if (status.status === lastStatus) return;
|
|
72
|
+
lastStatus = status.status;
|
|
73
|
+
|
|
62
74
|
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
63
|
-
console.log("[CoupleFuture]
|
|
75
|
+
console.log("[CoupleFuture] Status:", status.status);
|
|
64
76
|
}
|
|
77
|
+
|
|
65
78
|
if (status.status === "IN_QUEUE") onProgress?.(20);
|
|
66
79
|
else if (status.status === "IN_PROGRESS") onProgress?.(50);
|
|
67
80
|
},
|
|
@@ -69,7 +82,7 @@ export async function executeCoupleFuture(
|
|
|
69
82
|
|
|
70
83
|
onProgress?.(90);
|
|
71
84
|
|
|
72
|
-
const data =
|
|
85
|
+
const data = result as { images?: Array<{ url: string }> };
|
|
73
86
|
const imageUrl = data?.images?.[0]?.url;
|
|
74
87
|
|
|
75
88
|
onProgress?.(100);
|