Skip to content
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
8 changes: 8 additions & 0 deletions packages/inference/src/providers/fal-ai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ export const FAL_AI_SUPPORTED_MODEL_IDS: ProviderMapping<FalAiId> = {
"text-to-image": {
"black-forest-labs/FLUX.1-schnell": "fal-ai/flux/schnell",
"black-forest-labs/FLUX.1-dev": "fal-ai/flux/dev",
"playgroundai/playground-v2.5-1024px-aesthetic": "fal-ai/playground-v25",
"ByteDance/SDXL-Lightning": "fal-ai/lightning-models",
"PixArt-alpha/PixArt-Sigma-XL-2-1024-MS": "fal-ai/pixart-sigma",
"stabilityai/stable-diffusion-3-medium": "fal-ai/stable-diffusion-v3-medium",
"Warlord-K/Sana-1024": "fal-ai/sana",
"fal/AuraFlow-v0.2": "fal-ai/aura-flow",
"stabilityai/stable-diffusion-3.5-large": "fal-ai/stable-diffusion-v35-large",
"Kwai-Kolors/Kolors": "fal-ai/kolors",
},
"automatic-speech-recognition": {
"openai/whisper-large-v3": "fal-ai/whisper",
Expand Down
39 changes: 22 additions & 17 deletions packages/inference/test/HfInference.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { expect, it, describe, assert } from "vitest";

import type { ChatCompletionStreamOutput } from "@huggingface/tasks";

import { chatCompletion, HfInference } from "../src";
import { chatCompletion, FAL_AI_SUPPORTED_MODEL_IDS, HfInference } from "../src";
import "./vcr";
import { readTestFile } from "./test-files";

Expand Down Expand Up @@ -775,25 +775,30 @@ describe.concurrent("HfInference", () => {
() => {
const client = new HfInference(env.HF_FAL_KEY);

it("textToImage", async () => {
const res = await client.textToImage({
model: "black-forest-labs/FLUX.1-schnell",
provider: "fal-ai",
inputs: "black forest gateau cake spelling out the words FLUX SCHNELL, tasty, food photography, dynamic shot",
for (const model of Object.keys(FAL_AI_SUPPORTED_MODEL_IDS["text-to-image"] ?? {})) {
it(`textToImage - ${model}`, async () => {
const res = await client.textToImage({
model,
provider: "fal-ai",
inputs:
"Extreme close-up of a single tiger eye, direct frontal view. Detailed iris and pupil. Sharp focus on eye texture and color. Natural lighting to capture authentic eye shine and depth.",
});
expect(res).toBeInstanceOf(Blob);
});
expect(res).toBeInstanceOf(Blob);
});
}

it("speechToText", async () => {
const res = await client.automaticSpeechRecognition({
model: "openai/whisper-large-v3",
provider: "fal-ai",
data: new Blob([readTestFile("sample2.wav")], { type: "audio/x-wav" }),
});
expect(res).toMatchObject({
text: " he has grave doubts whether sir frederick leighton's work is really greek after all and can discover in it but little of rocky ithaca",
for (const model of Object.keys(FAL_AI_SUPPORTED_MODEL_IDS["automatic-speech-recognition"] ?? {})) {
it(`automaticSpeechRecognition - ${model}`, async () => {
const res = await client.automaticSpeechRecognition({
model: model,
provider: "fal-ai",
data: new Blob([readTestFile("sample2.wav")], { type: "audio/x-wav" }),
});
expect(res).toMatchObject({
text: " he has grave doubts whether sir frederick leighton's work is really greek after all and can discover in it but little of rocky ithaca",
});
});
});
}
},
TIMEOUT
);
Expand Down
Loading
Loading