@weirdfingers/baseboards 0.9.5 → 0.9.7
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/dist/index.js +561 -469
- package/dist/index.js.map +1 -1
- package/package.json +2 -5
- package/templates/README.md +0 -122
- package/templates/api/.env.example +0 -65
- package/templates/api/ARTIFACT_RESOLUTION_GUIDE.md +0 -148
- package/templates/api/Dockerfile +0 -32
- package/templates/api/README.md +0 -264
- package/templates/api/alembic/env.py +0 -114
- package/templates/api/alembic/script.py.mako +0 -28
- package/templates/api/alembic/versions/20250101_000000_initial_schema.py +0 -506
- package/templates/api/alembic/versions/20251022_174729_remove_provider_name_from_generations.py +0 -75
- package/templates/api/alembic/versions/20251023_165852_switch_to_declarative_base_and_mapping.py +0 -467
- package/templates/api/alembic/versions/20251202_000000_add_artifact_lineage.py +0 -134
- package/templates/api/alembic/versions/2025925_62735_add_seed_data_for_default_tenant.py +0 -88
- package/templates/api/alembic.ini +0 -36
- package/templates/api/config/generators.yaml +0 -237
- package/templates/api/config/storage_config.yaml +0 -26
- package/templates/api/docs/ADDING_GENERATORS.md +0 -409
- package/templates/api/docs/GENERATORS_API.md +0 -502
- package/templates/api/docs/MIGRATIONS.md +0 -472
- package/templates/api/docs/TESTING_LIVE_APIS.md +0 -417
- package/templates/api/docs/storage_providers.md +0 -337
- package/templates/api/pyproject.toml +0 -205
- package/templates/api/src/boards/__init__.py +0 -10
- package/templates/api/src/boards/api/app.py +0 -172
- package/templates/api/src/boards/api/auth.py +0 -75
- package/templates/api/src/boards/api/endpoints/__init__.py +0 -3
- package/templates/api/src/boards/api/endpoints/jobs.py +0 -76
- package/templates/api/src/boards/api/endpoints/setup.py +0 -505
- package/templates/api/src/boards/api/endpoints/sse.py +0 -129
- package/templates/api/src/boards/api/endpoints/storage.py +0 -155
- package/templates/api/src/boards/api/endpoints/tenant_registration.py +0 -296
- package/templates/api/src/boards/api/endpoints/uploads.py +0 -149
- package/templates/api/src/boards/api/endpoints/webhooks.py +0 -13
- package/templates/api/src/boards/auth/__init__.py +0 -15
- package/templates/api/src/boards/auth/adapters/__init__.py +0 -27
- package/templates/api/src/boards/auth/adapters/auth0.py +0 -220
- package/templates/api/src/boards/auth/adapters/base.py +0 -73
- package/templates/api/src/boards/auth/adapters/clerk.py +0 -172
- package/templates/api/src/boards/auth/adapters/jwt.py +0 -122
- package/templates/api/src/boards/auth/adapters/none.py +0 -102
- package/templates/api/src/boards/auth/adapters/oidc.py +0 -284
- package/templates/api/src/boards/auth/adapters/supabase.py +0 -110
- package/templates/api/src/boards/auth/context.py +0 -35
- package/templates/api/src/boards/auth/factory.py +0 -129
- package/templates/api/src/boards/auth/middleware.py +0 -221
- package/templates/api/src/boards/auth/provisioning.py +0 -129
- package/templates/api/src/boards/auth/tenant_extraction.py +0 -278
- package/templates/api/src/boards/cli.py +0 -354
- package/templates/api/src/boards/config.py +0 -131
- package/templates/api/src/boards/database/__init__.py +0 -7
- package/templates/api/src/boards/database/cli.py +0 -110
- package/templates/api/src/boards/database/connection.py +0 -292
- package/templates/api/src/boards/database/models.py +0 -19
- package/templates/api/src/boards/database/seed_data.py +0 -182
- package/templates/api/src/boards/dbmodels/__init__.py +0 -441
- package/templates/api/src/boards/generators/__init__.py +0 -57
- package/templates/api/src/boards/generators/artifact_resolution.py +0 -405
- package/templates/api/src/boards/generators/artifacts.py +0 -53
- package/templates/api/src/boards/generators/base.py +0 -144
- package/templates/api/src/boards/generators/implementations/__init__.py +0 -14
- package/templates/api/src/boards/generators/implementations/fal/__init__.py +0 -25
- package/templates/api/src/boards/generators/implementations/fal/audio/__init__.py +0 -23
- package/templates/api/src/boards/generators/implementations/fal/audio/beatoven_music_generation.py +0 -171
- package/templates/api/src/boards/generators/implementations/fal/audio/beatoven_sound_effect_generation.py +0 -167
- package/templates/api/src/boards/generators/implementations/fal/audio/chatterbox_text_to_speech.py +0 -176
- package/templates/api/src/boards/generators/implementations/fal/audio/chatterbox_tts_turbo.py +0 -195
- package/templates/api/src/boards/generators/implementations/fal/audio/elevenlabs_sound_effects_v2.py +0 -194
- package/templates/api/src/boards/generators/implementations/fal/audio/elevenlabs_tts_eleven_v3.py +0 -209
- package/templates/api/src/boards/generators/implementations/fal/audio/fal_elevenlabs_tts_turbo_v2_5.py +0 -206
- package/templates/api/src/boards/generators/implementations/fal/audio/fal_minimax_speech_26_hd.py +0 -237
- package/templates/api/src/boards/generators/implementations/fal/audio/minimax_music_v2.py +0 -173
- package/templates/api/src/boards/generators/implementations/fal/audio/minimax_speech_2_6_turbo.py +0 -221
- package/templates/api/src/boards/generators/implementations/fal/image/__init__.py +0 -63
- package/templates/api/src/boards/generators/implementations/fal/image/bytedance_seedream_v45_edit.py +0 -219
- package/templates/api/src/boards/generators/implementations/fal/image/clarity_upscaler.py +0 -220
- package/templates/api/src/boards/generators/implementations/fal/image/crystal_upscaler.py +0 -173
- package/templates/api/src/boards/generators/implementations/fal/image/fal_ideogram_character.py +0 -227
- package/templates/api/src/boards/generators/implementations/fal/image/flux_2.py +0 -203
- package/templates/api/src/boards/generators/implementations/fal/image/flux_2_edit.py +0 -230
- package/templates/api/src/boards/generators/implementations/fal/image/flux_2_pro.py +0 -204
- package/templates/api/src/boards/generators/implementations/fal/image/flux_2_pro_edit.py +0 -221
- package/templates/api/src/boards/generators/implementations/fal/image/flux_pro_kontext.py +0 -216
- package/templates/api/src/boards/generators/implementations/fal/image/flux_pro_ultra.py +0 -197
- package/templates/api/src/boards/generators/implementations/fal/image/gemini_25_flash_image.py +0 -177
- package/templates/api/src/boards/generators/implementations/fal/image/gemini_25_flash_image_edit.py +0 -208
- package/templates/api/src/boards/generators/implementations/fal/image/gpt_image_15_edit.py +0 -216
- package/templates/api/src/boards/generators/implementations/fal/image/gpt_image_1_5.py +0 -177
- package/templates/api/src/boards/generators/implementations/fal/image/gpt_image_1_edit_image.py +0 -182
- package/templates/api/src/boards/generators/implementations/fal/image/gpt_image_1_mini.py +0 -167
- package/templates/api/src/boards/generators/implementations/fal/image/ideogram_character_edit.py +0 -299
- package/templates/api/src/boards/generators/implementations/fal/image/ideogram_v2.py +0 -190
- package/templates/api/src/boards/generators/implementations/fal/image/imagen4_preview.py +0 -191
- package/templates/api/src/boards/generators/implementations/fal/image/imagen4_preview_fast.py +0 -179
- package/templates/api/src/boards/generators/implementations/fal/image/nano_banana.py +0 -183
- package/templates/api/src/boards/generators/implementations/fal/image/nano_banana_edit.py +0 -212
- package/templates/api/src/boards/generators/implementations/fal/image/nano_banana_pro.py +0 -179
- package/templates/api/src/boards/generators/implementations/fal/image/nano_banana_pro_edit.py +0 -226
- package/templates/api/src/boards/generators/implementations/fal/image/qwen_image.py +0 -249
- package/templates/api/src/boards/generators/implementations/fal/image/qwen_image_edit.py +0 -244
- package/templates/api/src/boards/generators/implementations/fal/image/reve_edit.py +0 -178
- package/templates/api/src/boards/generators/implementations/fal/image/reve_text_to_image.py +0 -155
- package/templates/api/src/boards/generators/implementations/fal/image/seedream_v45_text_to_image.py +0 -180
- package/templates/api/src/boards/generators/implementations/fal/utils.py +0 -61
- package/templates/api/src/boards/generators/implementations/fal/video/__init__.py +0 -77
- package/templates/api/src/boards/generators/implementations/fal/video/bytedance_seedance_v1_pro_text_to_video.py +0 -209
- package/templates/api/src/boards/generators/implementations/fal/video/creatify_lipsync.py +0 -161
- package/templates/api/src/boards/generators/implementations/fal/video/fal_bytedance_seedance_v1_pro_image_to_video.py +0 -222
- package/templates/api/src/boards/generators/implementations/fal/video/fal_minimax_hailuo_02_standard_text_to_video.py +0 -152
- package/templates/api/src/boards/generators/implementations/fal/video/fal_pixverse_lipsync.py +0 -197
- package/templates/api/src/boards/generators/implementations/fal/video/fal_sora_2_text_to_video.py +0 -173
- package/templates/api/src/boards/generators/implementations/fal/video/infinitalk.py +0 -221
- package/templates/api/src/boards/generators/implementations/fal/video/kling_video_ai_avatar_v2_pro.py +0 -168
- package/templates/api/src/boards/generators/implementations/fal/video/kling_video_ai_avatar_v2_standard.py +0 -159
- package/templates/api/src/boards/generators/implementations/fal/video/kling_video_v2_5_turbo_pro_image_to_video.py +0 -175
- package/templates/api/src/boards/generators/implementations/fal/video/kling_video_v2_5_turbo_pro_text_to_video.py +0 -168
- package/templates/api/src/boards/generators/implementations/fal/video/minimax_hailuo_2_3_pro_image_to_video.py +0 -153
- package/templates/api/src/boards/generators/implementations/fal/video/sora2_image_to_video.py +0 -172
- package/templates/api/src/boards/generators/implementations/fal/video/sora_2_image_to_video_pro.py +0 -175
- package/templates/api/src/boards/generators/implementations/fal/video/sora_2_text_to_video_pro.py +0 -163
- package/templates/api/src/boards/generators/implementations/fal/video/sync_lipsync_v2.py +0 -167
- package/templates/api/src/boards/generators/implementations/fal/video/sync_lipsync_v2_pro.py +0 -155
- package/templates/api/src/boards/generators/implementations/fal/video/veed_fabric_1_0.py +0 -180
- package/templates/api/src/boards/generators/implementations/fal/video/veed_lipsync.py +0 -174
- package/templates/api/src/boards/generators/implementations/fal/video/veo3.py +0 -194
- package/templates/api/src/boards/generators/implementations/fal/video/veo31.py +0 -190
- package/templates/api/src/boards/generators/implementations/fal/video/veo31_fast.py +0 -190
- package/templates/api/src/boards/generators/implementations/fal/video/veo31_fast_image_to_video.py +0 -191
- package/templates/api/src/boards/generators/implementations/fal/video/veo31_first_last_frame_to_video.py +0 -187
- package/templates/api/src/boards/generators/implementations/fal/video/veo31_image_to_video.py +0 -183
- package/templates/api/src/boards/generators/implementations/fal/video/veo31_reference_to_video.py +0 -172
- package/templates/api/src/boards/generators/implementations/fal/video/wan_25_preview_image_to_video.py +0 -212
- package/templates/api/src/boards/generators/implementations/fal/video/wan_25_preview_text_to_video.py +0 -208
- package/templates/api/src/boards/generators/implementations/fal/video/wan_pro_image_to_video.py +0 -158
- package/templates/api/src/boards/generators/implementations/kie/__init__.py +0 -11
- package/templates/api/src/boards/generators/implementations/kie/base.py +0 -316
- package/templates/api/src/boards/generators/implementations/kie/image/__init__.py +0 -3
- package/templates/api/src/boards/generators/implementations/kie/image/nano_banana_edit.py +0 -190
- package/templates/api/src/boards/generators/implementations/kie/utils.py +0 -98
- package/templates/api/src/boards/generators/implementations/kie/video/__init__.py +0 -8
- package/templates/api/src/boards/generators/implementations/kie/video/veo3.py +0 -161
- package/templates/api/src/boards/generators/implementations/openai/__init__.py +0 -1
- package/templates/api/src/boards/generators/implementations/openai/audio/__init__.py +0 -1
- package/templates/api/src/boards/generators/implementations/openai/audio/whisper.py +0 -69
- package/templates/api/src/boards/generators/implementations/openai/image/__init__.py +0 -1
- package/templates/api/src/boards/generators/implementations/openai/image/dalle3.py +0 -96
- package/templates/api/src/boards/generators/implementations/replicate/__init__.py +0 -1
- package/templates/api/src/boards/generators/implementations/replicate/image/__init__.py +0 -1
- package/templates/api/src/boards/generators/implementations/replicate/image/flux_pro.py +0 -88
- package/templates/api/src/boards/generators/implementations/replicate/video/__init__.py +0 -1
- package/templates/api/src/boards/generators/implementations/replicate/video/lipsync.py +0 -73
- package/templates/api/src/boards/generators/loader.py +0 -253
- package/templates/api/src/boards/generators/registry.py +0 -114
- package/templates/api/src/boards/generators/resolution.py +0 -632
- package/templates/api/src/boards/generators/testmods/class_gen.py +0 -34
- package/templates/api/src/boards/generators/testmods/import_side_effect.py +0 -35
- package/templates/api/src/boards/graphql/__init__.py +0 -7
- package/templates/api/src/boards/graphql/access_control.py +0 -136
- package/templates/api/src/boards/graphql/mutations/root.py +0 -148
- package/templates/api/src/boards/graphql/queries/root.py +0 -116
- package/templates/api/src/boards/graphql/resolvers/__init__.py +0 -8
- package/templates/api/src/boards/graphql/resolvers/auth.py +0 -12
- package/templates/api/src/boards/graphql/resolvers/board.py +0 -1053
- package/templates/api/src/boards/graphql/resolvers/generation.py +0 -666
- package/templates/api/src/boards/graphql/resolvers/generator.py +0 -50
- package/templates/api/src/boards/graphql/resolvers/lineage.py +0 -381
- package/templates/api/src/boards/graphql/resolvers/upload.py +0 -463
- package/templates/api/src/boards/graphql/resolvers/user.py +0 -25
- package/templates/api/src/boards/graphql/schema.py +0 -81
- package/templates/api/src/boards/graphql/types/board.py +0 -102
- package/templates/api/src/boards/graphql/types/generation.py +0 -166
- package/templates/api/src/boards/graphql/types/generator.py +0 -17
- package/templates/api/src/boards/graphql/types/user.py +0 -47
- package/templates/api/src/boards/jobs/repository.py +0 -153
- package/templates/api/src/boards/logging.py +0 -195
- package/templates/api/src/boards/middleware.py +0 -339
- package/templates/api/src/boards/progress/__init__.py +0 -4
- package/templates/api/src/boards/progress/models.py +0 -25
- package/templates/api/src/boards/progress/publisher.py +0 -64
- package/templates/api/src/boards/py.typed +0 -0
- package/templates/api/src/boards/redis_pool.py +0 -118
- package/templates/api/src/boards/storage/__init__.py +0 -52
- package/templates/api/src/boards/storage/base.py +0 -363
- package/templates/api/src/boards/storage/config.py +0 -187
- package/templates/api/src/boards/storage/factory.py +0 -288
- package/templates/api/src/boards/storage/implementations/__init__.py +0 -27
- package/templates/api/src/boards/storage/implementations/gcs.py +0 -340
- package/templates/api/src/boards/storage/implementations/local.py +0 -201
- package/templates/api/src/boards/storage/implementations/s3.py +0 -294
- package/templates/api/src/boards/storage/implementations/supabase.py +0 -218
- package/templates/api/src/boards/tenant_isolation.py +0 -446
- package/templates/api/src/boards/validation.py +0 -262
- package/templates/api/src/boards/workers/__init__.py +0 -1
- package/templates/api/src/boards/workers/actors.py +0 -274
- package/templates/api/src/boards/workers/cli.py +0 -125
- package/templates/api/src/boards/workers/context.py +0 -348
- package/templates/api/src/boards/workers/middleware.py +0 -58
- package/templates/api/src/py.typed +0 -0
- package/templates/compose.web.yaml +0 -35
- package/templates/compose.yaml +0 -116
- package/templates/docker/env.example +0 -23
- package/templates/web/.env.example +0 -28
- package/templates/web/Dockerfile +0 -51
- package/templates/web/components.json +0 -22
- package/templates/web/imageLoader.js +0 -18
- package/templates/web/next-env.d.ts +0 -5
- package/templates/web/next.config.js +0 -36
- package/templates/web/package.json +0 -41
- package/templates/web/postcss.config.mjs +0 -7
- package/templates/web/public/favicon.ico +0 -0
- package/templates/web/src/app/boards/[boardId]/page.tsx +0 -353
- package/templates/web/src/app/globals.css +0 -123
- package/templates/web/src/app/layout.tsx +0 -31
- package/templates/web/src/app/lineage/[generationId]/page.tsx +0 -235
- package/templates/web/src/app/page.tsx +0 -35
- package/templates/web/src/app/providers.tsx +0 -18
- package/templates/web/src/components/boards/ArtifactInputSlots.tsx +0 -206
- package/templates/web/src/components/boards/ArtifactPreview.tsx +0 -466
- package/templates/web/src/components/boards/GenerationGrid.tsx +0 -282
- package/templates/web/src/components/boards/GenerationInput.tsx +0 -370
- package/templates/web/src/components/boards/GeneratorSelector.tsx +0 -272
- package/templates/web/src/components/boards/UploadArtifact.tsx +0 -563
- package/templates/web/src/components/header.tsx +0 -32
- package/templates/web/src/components/theme-provider.tsx +0 -10
- package/templates/web/src/components/theme-toggle.tsx +0 -75
- package/templates/web/src/components/ui/alert-dialog.tsx +0 -157
- package/templates/web/src/components/ui/button.tsx +0 -58
- package/templates/web/src/components/ui/card.tsx +0 -92
- package/templates/web/src/components/ui/dropdown-menu.tsx +0 -200
- package/templates/web/src/components/ui/navigation-menu.tsx +0 -168
- package/templates/web/src/components/ui/toast.tsx +0 -128
- package/templates/web/src/components/ui/toaster.tsx +0 -35
- package/templates/web/src/components/ui/use-toast.ts +0 -187
- package/templates/web/src/hooks/useGeneratorMRU.ts +0 -57
- package/templates/web/src/lib/utils.ts +0 -6
- package/templates/web/tsconfig.json +0 -41
package/templates/api/src/boards/generators/implementations/fal/video/fal_sora_2_text_to_video.py
DELETED
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Sora 2 text-to-video generator.
|
|
3
|
-
|
|
4
|
-
Text-to-video endpoint for Sora 2, OpenAI's state-of-the-art video model capable of
|
|
5
|
-
creating richly detailed, dynamic clips with audio from natural language prompts.
|
|
6
|
-
|
|
7
|
-
Based on Fal AI's fal-ai/sora-2/text-to-video model.
|
|
8
|
-
See: https://fal.ai/models/fal-ai/sora-2/text-to-video
|
|
9
|
-
"""
|
|
10
|
-
|
|
11
|
-
import os
|
|
12
|
-
from typing import Literal
|
|
13
|
-
|
|
14
|
-
from pydantic import BaseModel, Field
|
|
15
|
-
|
|
16
|
-
from ....base import BaseGenerator, GeneratorExecutionContext, GeneratorResult
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
class Sora2TextToVideoInput(BaseModel):
|
|
20
|
-
"""Input schema for Sora 2 text-to-video generation.
|
|
21
|
-
|
|
22
|
-
Artifact fields are automatically detected via type introspection
|
|
23
|
-
and resolved from generation IDs to artifact objects.
|
|
24
|
-
"""
|
|
25
|
-
|
|
26
|
-
prompt: str = Field(
|
|
27
|
-
description="Text description of desired video",
|
|
28
|
-
min_length=1,
|
|
29
|
-
max_length=5000,
|
|
30
|
-
)
|
|
31
|
-
resolution: Literal["720p"] = Field(
|
|
32
|
-
default="720p",
|
|
33
|
-
description="Video output quality (currently only 720p is supported)",
|
|
34
|
-
)
|
|
35
|
-
aspect_ratio: Literal["9:16", "16:9"] = Field(
|
|
36
|
-
default="16:9",
|
|
37
|
-
description="Video dimensions",
|
|
38
|
-
)
|
|
39
|
-
duration: Literal[4, 8, 12] = Field(
|
|
40
|
-
default=4,
|
|
41
|
-
description="Video length in seconds",
|
|
42
|
-
)
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
class FalSora2TextToVideoGenerator(BaseGenerator):
|
|
46
|
-
"""Generator for text-to-video using Sora 2."""
|
|
47
|
-
|
|
48
|
-
name = "fal-sora-2-text-to-video"
|
|
49
|
-
description = (
|
|
50
|
-
"Fal: Sora 2 - OpenAI's state-of-the-art text-to-video with richly detailed, dynamic clips"
|
|
51
|
-
)
|
|
52
|
-
artifact_type = "video"
|
|
53
|
-
|
|
54
|
-
def get_input_schema(self) -> type[Sora2TextToVideoInput]:
|
|
55
|
-
"""Return the input schema for this generator."""
|
|
56
|
-
return Sora2TextToVideoInput
|
|
57
|
-
|
|
58
|
-
async def generate(
|
|
59
|
-
self, inputs: Sora2TextToVideoInput, context: GeneratorExecutionContext
|
|
60
|
-
) -> GeneratorResult:
|
|
61
|
-
"""Generate video using fal.ai Sora 2 model."""
|
|
62
|
-
# Check for API key
|
|
63
|
-
if not os.getenv("FAL_KEY"):
|
|
64
|
-
raise ValueError("API configuration invalid. Missing FAL_KEY environment variable")
|
|
65
|
-
|
|
66
|
-
# Import fal_client
|
|
67
|
-
try:
|
|
68
|
-
import fal_client
|
|
69
|
-
except ImportError as e:
|
|
70
|
-
raise ImportError(
|
|
71
|
-
"fal.ai SDK is required for FalSora2TextToVideoGenerator. "
|
|
72
|
-
"Install with: pip install weirdfingers-boards[generators-fal]"
|
|
73
|
-
) from e
|
|
74
|
-
|
|
75
|
-
# Prepare arguments for fal.ai API
|
|
76
|
-
arguments = {
|
|
77
|
-
"prompt": inputs.prompt,
|
|
78
|
-
"resolution": inputs.resolution,
|
|
79
|
-
"aspect_ratio": inputs.aspect_ratio,
|
|
80
|
-
"duration": inputs.duration,
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
# Submit async job
|
|
84
|
-
handler = await fal_client.submit_async(
|
|
85
|
-
"fal-ai/sora-2/text-to-video",
|
|
86
|
-
arguments=arguments,
|
|
87
|
-
)
|
|
88
|
-
|
|
89
|
-
# Store external job ID
|
|
90
|
-
await context.set_external_job_id(handler.request_id)
|
|
91
|
-
|
|
92
|
-
# Stream progress updates
|
|
93
|
-
from .....progress.models import ProgressUpdate
|
|
94
|
-
|
|
95
|
-
event_count = 0
|
|
96
|
-
async for event in handler.iter_events(with_logs=True):
|
|
97
|
-
event_count += 1
|
|
98
|
-
# Sample every 3rd event to avoid spam
|
|
99
|
-
if event_count % 3 == 0:
|
|
100
|
-
# Extract logs if available
|
|
101
|
-
logs = getattr(event, "logs", None)
|
|
102
|
-
if logs:
|
|
103
|
-
# Join log entries into a single message
|
|
104
|
-
if isinstance(logs, list):
|
|
105
|
-
message = " | ".join(str(log) for log in logs if log)
|
|
106
|
-
else:
|
|
107
|
-
message = str(logs)
|
|
108
|
-
|
|
109
|
-
if message:
|
|
110
|
-
await context.publish_progress(
|
|
111
|
-
ProgressUpdate(
|
|
112
|
-
job_id=handler.request_id,
|
|
113
|
-
status="processing",
|
|
114
|
-
progress=50.0, # Approximate mid-point progress
|
|
115
|
-
phase="processing",
|
|
116
|
-
message=message,
|
|
117
|
-
)
|
|
118
|
-
)
|
|
119
|
-
|
|
120
|
-
# Get final result
|
|
121
|
-
result = await handler.get()
|
|
122
|
-
|
|
123
|
-
# Extract video from result
|
|
124
|
-
# fal.ai returns: {"video": {"url": "...", "content_type": "video/mp4",
|
|
125
|
-
# "width": ..., "height": ..., "duration": ..., "fps": ...}}
|
|
126
|
-
video_data = result.get("video")
|
|
127
|
-
if not video_data:
|
|
128
|
-
raise ValueError("No video returned from fal.ai API")
|
|
129
|
-
|
|
130
|
-
video_url = video_data.get("url")
|
|
131
|
-
if not video_url:
|
|
132
|
-
raise ValueError("Video missing URL in fal.ai response")
|
|
133
|
-
|
|
134
|
-
# Extract video metadata from response or use defaults
|
|
135
|
-
width = video_data.get("width")
|
|
136
|
-
height = video_data.get("height")
|
|
137
|
-
duration = video_data.get("duration")
|
|
138
|
-
fps = video_data.get("fps")
|
|
139
|
-
|
|
140
|
-
# If dimensions not provided, determine based on aspect ratio and resolution
|
|
141
|
-
if width is None or height is None:
|
|
142
|
-
# 720p dimensions
|
|
143
|
-
aspect_ratio_dimensions = {
|
|
144
|
-
"16:9": (1280, 720),
|
|
145
|
-
"9:16": (720, 1280),
|
|
146
|
-
}
|
|
147
|
-
width, height = aspect_ratio_dimensions.get(inputs.aspect_ratio, (1280, 720))
|
|
148
|
-
|
|
149
|
-
# Store video result
|
|
150
|
-
artifact = await context.store_video_result(
|
|
151
|
-
storage_url=video_url,
|
|
152
|
-
format="mp4",
|
|
153
|
-
width=width,
|
|
154
|
-
height=height,
|
|
155
|
-
duration=float(duration) if duration else float(inputs.duration),
|
|
156
|
-
fps=fps,
|
|
157
|
-
output_index=0,
|
|
158
|
-
)
|
|
159
|
-
|
|
160
|
-
return GeneratorResult(outputs=[artifact])
|
|
161
|
-
|
|
162
|
-
async def estimate_cost(self, inputs: Sora2TextToVideoInput) -> float:
|
|
163
|
-
"""Estimate cost for Sora 2 generation.
|
|
164
|
-
|
|
165
|
-
Pricing information not provided in official documentation.
|
|
166
|
-
Estimated at $0.20 per video based on typical high-quality video generation costs.
|
|
167
|
-
Cost scales with duration.
|
|
168
|
-
"""
|
|
169
|
-
# Approximate cost per video - Sora 2 is likely higher cost due to quality
|
|
170
|
-
base_cost = 0.20
|
|
171
|
-
# Scale by duration: 4s = 1x, 8s = 2x, 12s = 3x
|
|
172
|
-
duration_multiplier = inputs.duration / 4
|
|
173
|
-
return base_cost * duration_multiplier
|
|
@@ -1,221 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
fal.ai infinitalk video generator.
|
|
3
|
-
|
|
4
|
-
Generates talking avatar videos from an image and audio file. The avatar
|
|
5
|
-
lip-syncs to the provided audio with natural facial expressions.
|
|
6
|
-
|
|
7
|
-
Based on Fal AI's fal-ai/infinitalk model.
|
|
8
|
-
See: https://fal.ai/models/fal-ai/infinitalk
|
|
9
|
-
"""
|
|
10
|
-
|
|
11
|
-
import os
|
|
12
|
-
from typing import Literal
|
|
13
|
-
|
|
14
|
-
from pydantic import BaseModel, Field
|
|
15
|
-
|
|
16
|
-
from ....artifacts import AudioArtifact, ImageArtifact
|
|
17
|
-
from ....base import BaseGenerator, GeneratorExecutionContext, GeneratorResult
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
class InfinitalkInput(BaseModel):
|
|
21
|
-
"""Input schema for infinitalk.
|
|
22
|
-
|
|
23
|
-
Artifact fields are automatically detected via type introspection
|
|
24
|
-
and resolved from generation IDs to artifact objects.
|
|
25
|
-
"""
|
|
26
|
-
|
|
27
|
-
image: ImageArtifact = Field(
|
|
28
|
-
description=(
|
|
29
|
-
"Input image for the avatar. "
|
|
30
|
-
"If the aspect ratio doesn't match, it is resized and center cropped"
|
|
31
|
-
)
|
|
32
|
-
)
|
|
33
|
-
audio: AudioArtifact = Field(description="Audio file to synchronize with the avatar")
|
|
34
|
-
prompt: str = Field(description="Text prompt to guide video generation")
|
|
35
|
-
num_frames: int = Field(
|
|
36
|
-
default=145,
|
|
37
|
-
ge=41,
|
|
38
|
-
le=721,
|
|
39
|
-
description="Number of frames to generate",
|
|
40
|
-
)
|
|
41
|
-
resolution: Literal["480p", "720p"] = Field(
|
|
42
|
-
default="480p",
|
|
43
|
-
description="Output video resolution",
|
|
44
|
-
)
|
|
45
|
-
acceleration: Literal["none", "regular", "high"] = Field(
|
|
46
|
-
default="regular",
|
|
47
|
-
description="Acceleration level for generation speed",
|
|
48
|
-
)
|
|
49
|
-
seed: int = Field(
|
|
50
|
-
default=42,
|
|
51
|
-
description="Seed for reproducibility",
|
|
52
|
-
)
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
class FalInfinitalkGenerator(BaseGenerator):
|
|
56
|
-
"""Generator for talking avatar videos from image and audio."""
|
|
57
|
-
|
|
58
|
-
name = "fal-infinitalk"
|
|
59
|
-
description = "Fal: infinitalk - Generate talking avatar video from image and audio"
|
|
60
|
-
artifact_type = "video"
|
|
61
|
-
|
|
62
|
-
def get_input_schema(self) -> type[InfinitalkInput]:
|
|
63
|
-
"""Return the input schema for this generator."""
|
|
64
|
-
return InfinitalkInput
|
|
65
|
-
|
|
66
|
-
async def generate(
|
|
67
|
-
self, inputs: InfinitalkInput, context: GeneratorExecutionContext
|
|
68
|
-
) -> GeneratorResult:
|
|
69
|
-
"""Generate talking avatar video using fal.ai infinitalk."""
|
|
70
|
-
# Check for API key
|
|
71
|
-
if not os.getenv("FAL_KEY"):
|
|
72
|
-
raise ValueError("API configuration invalid. Missing FAL_KEY environment variable")
|
|
73
|
-
|
|
74
|
-
# Import fal_client
|
|
75
|
-
try:
|
|
76
|
-
import fal_client
|
|
77
|
-
except ImportError as e:
|
|
78
|
-
raise ImportError(
|
|
79
|
-
"fal.ai SDK is required for FalInfinitalkGenerator. "
|
|
80
|
-
"Install with: pip install weirdfingers-boards[generators-fal]"
|
|
81
|
-
) from e
|
|
82
|
-
|
|
83
|
-
# Upload image and audio artifacts to Fal's public storage
|
|
84
|
-
# Fal API requires publicly accessible URLs
|
|
85
|
-
from ..utils import upload_artifacts_to_fal
|
|
86
|
-
|
|
87
|
-
# Upload image and audio separately
|
|
88
|
-
image_urls = await upload_artifacts_to_fal([inputs.image], context)
|
|
89
|
-
audio_urls = await upload_artifacts_to_fal([inputs.audio], context)
|
|
90
|
-
|
|
91
|
-
# Prepare arguments for fal.ai API
|
|
92
|
-
arguments = {
|
|
93
|
-
"image_url": image_urls[0],
|
|
94
|
-
"audio_url": audio_urls[0],
|
|
95
|
-
"prompt": inputs.prompt,
|
|
96
|
-
"num_frames": inputs.num_frames,
|
|
97
|
-
"resolution": inputs.resolution,
|
|
98
|
-
"acceleration": inputs.acceleration,
|
|
99
|
-
"seed": inputs.seed,
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
# Submit async job
|
|
103
|
-
handler = await fal_client.submit_async(
|
|
104
|
-
"fal-ai/infinitalk",
|
|
105
|
-
arguments=arguments,
|
|
106
|
-
)
|
|
107
|
-
|
|
108
|
-
# Store external job ID
|
|
109
|
-
await context.set_external_job_id(handler.request_id)
|
|
110
|
-
|
|
111
|
-
# Stream progress updates
|
|
112
|
-
from .....progress.models import ProgressUpdate
|
|
113
|
-
|
|
114
|
-
event_count = 0
|
|
115
|
-
async for event in handler.iter_events(with_logs=True):
|
|
116
|
-
event_count += 1
|
|
117
|
-
# Sample every 3rd event to avoid spam
|
|
118
|
-
if event_count % 3 == 0:
|
|
119
|
-
# Extract logs if available
|
|
120
|
-
logs = getattr(event, "logs", None)
|
|
121
|
-
if logs:
|
|
122
|
-
# Join log entries into a single message
|
|
123
|
-
if isinstance(logs, list):
|
|
124
|
-
message = " | ".join(str(log) for log in logs if log)
|
|
125
|
-
else:
|
|
126
|
-
message = str(logs)
|
|
127
|
-
|
|
128
|
-
if message:
|
|
129
|
-
await context.publish_progress(
|
|
130
|
-
ProgressUpdate(
|
|
131
|
-
job_id=handler.request_id,
|
|
132
|
-
status="processing",
|
|
133
|
-
progress=50.0, # Approximate mid-point progress
|
|
134
|
-
phase="processing",
|
|
135
|
-
message=message,
|
|
136
|
-
)
|
|
137
|
-
)
|
|
138
|
-
|
|
139
|
-
# Get final result
|
|
140
|
-
result = await handler.get()
|
|
141
|
-
|
|
142
|
-
# Extract video from result
|
|
143
|
-
# fal.ai returns: {"video": {"url": "...", "content_type": "video/mp4", ...}, "seed": 42}
|
|
144
|
-
video_data = result.get("video")
|
|
145
|
-
|
|
146
|
-
if not video_data:
|
|
147
|
-
raise ValueError("No video returned from fal.ai API")
|
|
148
|
-
|
|
149
|
-
video_url = video_data.get("url")
|
|
150
|
-
if not video_url:
|
|
151
|
-
raise ValueError("Video missing URL in fal.ai response")
|
|
152
|
-
|
|
153
|
-
# Extract format from content_type (e.g., "video/mp4" -> "mp4")
|
|
154
|
-
# Infinitalk always produces MP4 videos, so default to mp4
|
|
155
|
-
content_type = video_data.get("content_type", "video/mp4")
|
|
156
|
-
if content_type.startswith("video/"):
|
|
157
|
-
video_format = content_type.split("/")[-1]
|
|
158
|
-
else:
|
|
159
|
-
# If content_type is not a video mime type (e.g., application/octet-stream),
|
|
160
|
-
# default to mp4 since infinitalk only produces mp4 videos
|
|
161
|
-
video_format = "mp4"
|
|
162
|
-
|
|
163
|
-
# Store the video result
|
|
164
|
-
# Use input image dimensions and audio duration for metadata
|
|
165
|
-
# Estimate FPS based on num_frames and audio duration
|
|
166
|
-
fps = 30.0 # Default FPS
|
|
167
|
-
if inputs.audio.duration and inputs.audio.duration > 0:
|
|
168
|
-
fps = inputs.num_frames / inputs.audio.duration
|
|
169
|
-
|
|
170
|
-
# Parse resolution to get dimensions
|
|
171
|
-
width, height = self._parse_resolution(inputs.resolution)
|
|
172
|
-
|
|
173
|
-
artifact = await context.store_video_result(
|
|
174
|
-
storage_url=video_url,
|
|
175
|
-
format=video_format,
|
|
176
|
-
width=width,
|
|
177
|
-
height=height,
|
|
178
|
-
duration=inputs.audio.duration,
|
|
179
|
-
fps=int(fps),
|
|
180
|
-
output_index=0,
|
|
181
|
-
)
|
|
182
|
-
|
|
183
|
-
return GeneratorResult(outputs=[artifact])
|
|
184
|
-
|
|
185
|
-
def _parse_resolution(self, resolution: str) -> tuple[int, int]:
|
|
186
|
-
"""Parse resolution string to width and height.
|
|
187
|
-
|
|
188
|
-
Args:
|
|
189
|
-
resolution: Resolution string like "480p" or "720p"
|
|
190
|
-
|
|
191
|
-
Returns:
|
|
192
|
-
Tuple of (width, height)
|
|
193
|
-
"""
|
|
194
|
-
if resolution == "480p":
|
|
195
|
-
return (854, 480)
|
|
196
|
-
elif resolution == "720p":
|
|
197
|
-
return (1280, 720)
|
|
198
|
-
else:
|
|
199
|
-
# Default to 480p
|
|
200
|
-
return (854, 480)
|
|
201
|
-
|
|
202
|
-
async def estimate_cost(self, inputs: InfinitalkInput) -> float:
|
|
203
|
-
"""Estimate cost for infinitalk generation in USD.
|
|
204
|
-
|
|
205
|
-
Pricing not specified in documentation, using estimate based on
|
|
206
|
-
typical video generation costs. Higher resolution and more frames
|
|
207
|
-
may increase cost.
|
|
208
|
-
"""
|
|
209
|
-
# Base cost estimate per generation
|
|
210
|
-
base_cost = 0.10
|
|
211
|
-
|
|
212
|
-
# Adjust for resolution
|
|
213
|
-
if inputs.resolution == "720p":
|
|
214
|
-
base_cost *= 1.5
|
|
215
|
-
|
|
216
|
-
# Adjust for frame count (more frames = higher cost)
|
|
217
|
-
# Base estimate is for 145 frames
|
|
218
|
-
frame_multiplier = inputs.num_frames / 145.0
|
|
219
|
-
base_cost *= frame_multiplier
|
|
220
|
-
|
|
221
|
-
return base_cost
|
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
fal.ai Kling Video AI Avatar v2 Pro generator.
|
|
3
|
-
|
|
4
|
-
Transforms static portrait images into synchronized talking avatar videos
|
|
5
|
-
with audio-driven facial animation. Supports realistic humans, animals,
|
|
6
|
-
cartoons, and stylized figures.
|
|
7
|
-
|
|
8
|
-
Based on Fal AI's fal-ai/kling-video/ai-avatar/v2/pro model.
|
|
9
|
-
See: https://fal.ai/models/fal-ai/kling-video/ai-avatar/v2/pro
|
|
10
|
-
"""
|
|
11
|
-
|
|
12
|
-
import os
|
|
13
|
-
|
|
14
|
-
from pydantic import BaseModel, Field
|
|
15
|
-
|
|
16
|
-
from ....artifacts import AudioArtifact, ImageArtifact
|
|
17
|
-
from ....base import BaseGenerator, GeneratorExecutionContext, GeneratorResult
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
class KlingVideoAiAvatarV2ProInput(BaseModel):
|
|
21
|
-
"""Input schema for kling-video/ai-avatar/v2/pro.
|
|
22
|
-
|
|
23
|
-
Artifact fields are automatically detected via type introspection
|
|
24
|
-
and resolved from generation IDs to artifact objects.
|
|
25
|
-
"""
|
|
26
|
-
|
|
27
|
-
image: ImageArtifact = Field(description="The image to use as your avatar")
|
|
28
|
-
audio: AudioArtifact = Field(description="The audio file for lip-sync animation")
|
|
29
|
-
prompt: str = Field(
|
|
30
|
-
default=".",
|
|
31
|
-
description="Optional prompt to refine animation details",
|
|
32
|
-
)
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
class FalKlingVideoAiAvatarV2ProGenerator(BaseGenerator):
|
|
36
|
-
"""Generator for AI avatar talking videos using Kling Video AI Avatar v2 Pro."""
|
|
37
|
-
|
|
38
|
-
name = "fal-kling-video-ai-avatar-v2-pro"
|
|
39
|
-
description = (
|
|
40
|
-
"Fal: Kling Video AI Avatar v2 Pro - "
|
|
41
|
-
"Transform portraits into talking avatar videos with audio-driven facial animation"
|
|
42
|
-
)
|
|
43
|
-
artifact_type = "video"
|
|
44
|
-
|
|
45
|
-
def get_input_schema(self) -> type[KlingVideoAiAvatarV2ProInput]:
|
|
46
|
-
"""Return the input schema for this generator."""
|
|
47
|
-
return KlingVideoAiAvatarV2ProInput
|
|
48
|
-
|
|
49
|
-
async def generate(
|
|
50
|
-
self, inputs: KlingVideoAiAvatarV2ProInput, context: GeneratorExecutionContext
|
|
51
|
-
) -> GeneratorResult:
|
|
52
|
-
"""Generate talking avatar video using fal.ai kling-video/ai-avatar/v2/pro."""
|
|
53
|
-
# Check for API key
|
|
54
|
-
if not os.getenv("FAL_KEY"):
|
|
55
|
-
raise ValueError("API configuration invalid. Missing FAL_KEY environment variable")
|
|
56
|
-
|
|
57
|
-
# Import fal_client
|
|
58
|
-
try:
|
|
59
|
-
import fal_client
|
|
60
|
-
except ImportError as e:
|
|
61
|
-
raise ImportError(
|
|
62
|
-
"fal.ai SDK is required for FalKlingVideoAiAvatarV2ProGenerator. "
|
|
63
|
-
"Install with: pip install weirdfingers-boards[generators-fal]"
|
|
64
|
-
) from e
|
|
65
|
-
|
|
66
|
-
# Upload image and audio artifacts to Fal's public storage
|
|
67
|
-
# Fal API requires publicly accessible URLs
|
|
68
|
-
from ..utils import upload_artifacts_to_fal
|
|
69
|
-
|
|
70
|
-
# Upload image and audio separately
|
|
71
|
-
image_urls = await upload_artifacts_to_fal([inputs.image], context)
|
|
72
|
-
audio_urls = await upload_artifacts_to_fal([inputs.audio], context)
|
|
73
|
-
|
|
74
|
-
# Prepare arguments for fal.ai API
|
|
75
|
-
arguments: dict[str, str] = {
|
|
76
|
-
"image_url": image_urls[0],
|
|
77
|
-
"audio_url": audio_urls[0],
|
|
78
|
-
"prompt": inputs.prompt,
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
# Submit async job
|
|
82
|
-
handler = await fal_client.submit_async(
|
|
83
|
-
"fal-ai/kling-video/ai-avatar/v2/pro",
|
|
84
|
-
arguments=arguments,
|
|
85
|
-
)
|
|
86
|
-
|
|
87
|
-
# Store external job ID
|
|
88
|
-
await context.set_external_job_id(handler.request_id)
|
|
89
|
-
|
|
90
|
-
# Stream progress updates
|
|
91
|
-
from .....progress.models import ProgressUpdate
|
|
92
|
-
|
|
93
|
-
event_count = 0
|
|
94
|
-
async for event in handler.iter_events(with_logs=True):
|
|
95
|
-
event_count += 1
|
|
96
|
-
# Sample every 3rd event to avoid spam
|
|
97
|
-
if event_count % 3 == 0:
|
|
98
|
-
# Extract logs if available
|
|
99
|
-
logs = getattr(event, "logs", None)
|
|
100
|
-
if logs:
|
|
101
|
-
# Join log entries into a single message
|
|
102
|
-
if isinstance(logs, list):
|
|
103
|
-
message = " | ".join(str(log) for log in logs if log)
|
|
104
|
-
else:
|
|
105
|
-
message = str(logs)
|
|
106
|
-
|
|
107
|
-
if message:
|
|
108
|
-
await context.publish_progress(
|
|
109
|
-
ProgressUpdate(
|
|
110
|
-
job_id=handler.request_id,
|
|
111
|
-
status="processing",
|
|
112
|
-
progress=50.0, # Approximate mid-point progress
|
|
113
|
-
phase="processing",
|
|
114
|
-
message=message,
|
|
115
|
-
)
|
|
116
|
-
)
|
|
117
|
-
|
|
118
|
-
# Get final result
|
|
119
|
-
result = await handler.get()
|
|
120
|
-
|
|
121
|
-
# Extract video from result
|
|
122
|
-
# fal.ai returns: {"video": {"url": "...", "content_type": "..."}, "duration": ...}
|
|
123
|
-
video_data = result.get("video")
|
|
124
|
-
|
|
125
|
-
if not video_data:
|
|
126
|
-
raise ValueError("No video returned from fal.ai API")
|
|
127
|
-
|
|
128
|
-
video_url = video_data.get("url")
|
|
129
|
-
if not video_url:
|
|
130
|
-
raise ValueError("Video missing URL in fal.ai response")
|
|
131
|
-
|
|
132
|
-
# Extract format from content_type (e.g., "video/mp4" -> "mp4")
|
|
133
|
-
content_type = video_data.get("content_type", "video/mp4")
|
|
134
|
-
if content_type.startswith("video/"):
|
|
135
|
-
video_format = content_type.split("/")[-1]
|
|
136
|
-
else:
|
|
137
|
-
# Default to mp4 if content_type is not a video mime type
|
|
138
|
-
video_format = "mp4"
|
|
139
|
-
|
|
140
|
-
# Get duration from result if available
|
|
141
|
-
duration = result.get("duration")
|
|
142
|
-
|
|
143
|
-
# Store the video result
|
|
144
|
-
# Note: The API doesn't return width/height/fps, so we use reasonable defaults
|
|
145
|
-
artifact = await context.store_video_result(
|
|
146
|
-
storage_url=video_url,
|
|
147
|
-
format=video_format,
|
|
148
|
-
width=None,
|
|
149
|
-
height=None,
|
|
150
|
-
duration=duration,
|
|
151
|
-
fps=None,
|
|
152
|
-
output_index=0,
|
|
153
|
-
)
|
|
154
|
-
|
|
155
|
-
return GeneratorResult(outputs=[artifact])
|
|
156
|
-
|
|
157
|
-
async def estimate_cost(self, inputs: KlingVideoAiAvatarV2ProInput) -> float:
|
|
158
|
-
"""Estimate cost for this generation in USD.
|
|
159
|
-
|
|
160
|
-
Pricing: $0.115 per second of generated video.
|
|
161
|
-
Cost depends on audio duration since the output video matches audio length.
|
|
162
|
-
"""
|
|
163
|
-
# If audio duration is available, calculate based on that
|
|
164
|
-
if inputs.audio.duration is not None:
|
|
165
|
-
return 0.115 * inputs.audio.duration
|
|
166
|
-
|
|
167
|
-
# Default estimate for unknown duration (assume ~10 second video)
|
|
168
|
-
return 1.15
|