Skip to content

Commit

Permalink
FAL image settings escape hatch
Browse files Browse the repository at this point in the history
  • Loading branch information
daojonesceo committed Dec 3, 2024
1 parent a0992ff commit ff14809
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/core/src/generation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -907,7 +907,7 @@ export const generateImage = async (
const blob = await imageResponse.blob();
const arrayBuffer = await blob.arrayBuffer();
const base64 = Buffer.from(arrayBuffer).toString('base64');

// Return with proper MIME type
return `data:image/jpeg;base64,${base64}`;
}));
Expand All @@ -930,7 +930,8 @@ export const generateImage = async (
num_inference_steps: modelSettings?.steps ?? 50,
guidance_scale: data.guidanceScale || 3.5,
num_images: data.count,
enable_safety_checker: true,
enable_safety_checker: modelSettings?.fal?.enableSafetyChecker ?? true,
safety_tolerance: modelSettings?.fal?.safetyTolerance ?? 2,
output_format: "png" as const,
seed: data.seed ?? 6252023,
...(runtime.getSetting("FAL_AI_LORA_PATH")
Expand Down
4 changes: 4 additions & 0 deletions packages/core/src/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,10 @@ export const models: Models = {
},
imageSettings: {
steps: 28,
fal: {
enableSafetyChecker: true,
safetyTolerance: 2,
},
},
endpoint: "https://api.fal.ai/v1",
model: {
Expand Down
4 changes: 4 additions & 0 deletions packages/core/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,10 @@ export type Model = {
/** Optional image generation settings */
imageSettings?: {
steps?: number;
fal?: {
enableSafetyChecker: boolean;
safetyTolerance: number;
};
};

/** Model names by size class */
Expand Down

0 comments on commit ff14809

Please sign in to comment.