@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
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
fal.ai ElevenLabs TTS Turbo v2.5 text-to-speech generator.
|
|
3
|
-
|
|
4
|
-
Generate high-speed text-to-speech audio using ElevenLabs TTS Turbo v2.5.
|
|
5
|
-
Converts written text into spoken audio with customizable voice, speed, and prosody parameters.
|
|
6
|
-
|
|
7
|
-
Based on Fal AI's fal-ai/elevenlabs/tts/turbo-v2.5 model.
|
|
8
|
-
See: https://fal.ai/models/fal-ai/elevenlabs/tts/turbo-v2.5
|
|
9
|
-
"""
|
|
10
|
-
|
|
11
|
-
import os
|
|
12
|
-
|
|
13
|
-
from pydantic import BaseModel, Field
|
|
14
|
-
|
|
15
|
-
from ....base import BaseGenerator, GeneratorExecutionContext, GeneratorResult
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
class FalElevenlabsTtsTurboV25Input(BaseModel):
|
|
19
|
-
"""Input schema for ElevenLabs TTS Turbo v2.5 generation.
|
|
20
|
-
|
|
21
|
-
Artifact fields are automatically detected via type introspection
|
|
22
|
-
and resolved from generation IDs to artifact objects.
|
|
23
|
-
"""
|
|
24
|
-
|
|
25
|
-
text: str = Field(
|
|
26
|
-
description="The text to convert to speech",
|
|
27
|
-
min_length=1,
|
|
28
|
-
)
|
|
29
|
-
|
|
30
|
-
voice: str = Field(
|
|
31
|
-
default="Rachel",
|
|
32
|
-
description=(
|
|
33
|
-
"Voice selection from predefined options (Aria, Roger, Sarah, Laura, Rachel, etc.)"
|
|
34
|
-
),
|
|
35
|
-
)
|
|
36
|
-
|
|
37
|
-
stability: float = Field(
|
|
38
|
-
default=0.5,
|
|
39
|
-
ge=0.0,
|
|
40
|
-
le=1.0,
|
|
41
|
-
description="Voice stability (0-1)",
|
|
42
|
-
)
|
|
43
|
-
|
|
44
|
-
similarity_boost: float = Field(
|
|
45
|
-
default=0.75,
|
|
46
|
-
ge=0.0,
|
|
47
|
-
le=1.0,
|
|
48
|
-
description="Voice similarity control (0-1)",
|
|
49
|
-
)
|
|
50
|
-
|
|
51
|
-
style: float = Field(
|
|
52
|
-
default=0.0,
|
|
53
|
-
ge=0.0,
|
|
54
|
-
le=1.0,
|
|
55
|
-
description="Style exaggeration (0-1)",
|
|
56
|
-
)
|
|
57
|
-
|
|
58
|
-
speed: float = Field(
|
|
59
|
-
default=1.0,
|
|
60
|
-
ge=0.7,
|
|
61
|
-
le=1.2,
|
|
62
|
-
description="Speech tempo adjustment (0.7-1.2x)",
|
|
63
|
-
)
|
|
64
|
-
|
|
65
|
-
timestamps: bool = Field(
|
|
66
|
-
default=False,
|
|
67
|
-
description="Include word-level timing data in output",
|
|
68
|
-
)
|
|
69
|
-
|
|
70
|
-
language_code: str | None = Field(
|
|
71
|
-
default=None,
|
|
72
|
-
description="ISO 639-1 language code for language enforcement (Turbo v2.5 only)",
|
|
73
|
-
)
|
|
74
|
-
|
|
75
|
-
previous_text: str | None = Field(
|
|
76
|
-
default=None,
|
|
77
|
-
description="Prior context for speech continuity when concatenating generations",
|
|
78
|
-
)
|
|
79
|
-
|
|
80
|
-
next_text: str | None = Field(
|
|
81
|
-
default=None,
|
|
82
|
-
description="Subsequent context for speech continuity when concatenating generations",
|
|
83
|
-
)
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
class FalElevenlabsTtsTurboV25Generator(BaseGenerator):
|
|
87
|
-
"""Generator for high-speed text-to-speech using ElevenLabs TTS Turbo v2.5."""
|
|
88
|
-
|
|
89
|
-
name = "fal-elevenlabs-tts-turbo-v2-5"
|
|
90
|
-
description = (
|
|
91
|
-
"Fal: ElevenLabs TTS Turbo v2.5 - "
|
|
92
|
-
"High-speed text-to-speech with customizable voices and prosody"
|
|
93
|
-
)
|
|
94
|
-
artifact_type = "audio"
|
|
95
|
-
|
|
96
|
-
def get_input_schema(self) -> type[FalElevenlabsTtsTurboV25Input]:
|
|
97
|
-
"""Return the input schema for this generator."""
|
|
98
|
-
return FalElevenlabsTtsTurboV25Input
|
|
99
|
-
|
|
100
|
-
async def generate(
|
|
101
|
-
self, inputs: FalElevenlabsTtsTurboV25Input, context: GeneratorExecutionContext
|
|
102
|
-
) -> GeneratorResult:
|
|
103
|
-
"""Generate audio using fal.ai ElevenLabs TTS Turbo v2.5."""
|
|
104
|
-
# Check for API key
|
|
105
|
-
if not os.getenv("FAL_KEY"):
|
|
106
|
-
raise ValueError("API configuration invalid. Missing FAL_KEY environment variable")
|
|
107
|
-
|
|
108
|
-
# Import fal_client
|
|
109
|
-
try:
|
|
110
|
-
import fal_client
|
|
111
|
-
except ImportError as e:
|
|
112
|
-
raise ImportError(
|
|
113
|
-
"fal.ai SDK is required for FalElevenlabsTtsTurboV25Generator. "
|
|
114
|
-
"Install with: pip install weirdfingers-boards[generators-fal]"
|
|
115
|
-
) from e
|
|
116
|
-
|
|
117
|
-
# Prepare arguments for fal.ai API
|
|
118
|
-
arguments = {
|
|
119
|
-
"text": inputs.text,
|
|
120
|
-
"voice": inputs.voice,
|
|
121
|
-
"stability": inputs.stability,
|
|
122
|
-
"similarity_boost": inputs.similarity_boost,
|
|
123
|
-
"style": inputs.style,
|
|
124
|
-
"speed": inputs.speed,
|
|
125
|
-
"timestamps": inputs.timestamps,
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
# Add optional fields only if provided
|
|
129
|
-
if inputs.language_code is not None:
|
|
130
|
-
arguments["language_code"] = inputs.language_code
|
|
131
|
-
if inputs.previous_text is not None:
|
|
132
|
-
arguments["previous_text"] = inputs.previous_text
|
|
133
|
-
if inputs.next_text is not None:
|
|
134
|
-
arguments["next_text"] = inputs.next_text
|
|
135
|
-
|
|
136
|
-
# Submit async job
|
|
137
|
-
handler = await fal_client.submit_async(
|
|
138
|
-
"fal-ai/elevenlabs/tts/turbo-v2.5",
|
|
139
|
-
arguments=arguments,
|
|
140
|
-
)
|
|
141
|
-
|
|
142
|
-
# Store external job ID
|
|
143
|
-
await context.set_external_job_id(handler.request_id)
|
|
144
|
-
|
|
145
|
-
# Stream progress updates
|
|
146
|
-
from .....progress.models import ProgressUpdate
|
|
147
|
-
|
|
148
|
-
event_count = 0
|
|
149
|
-
async for event in handler.iter_events(with_logs=True):
|
|
150
|
-
event_count += 1
|
|
151
|
-
# Sample every 3rd event to avoid spam
|
|
152
|
-
if event_count % 3 == 0:
|
|
153
|
-
# Extract logs if available
|
|
154
|
-
logs = getattr(event, "logs", None)
|
|
155
|
-
if logs:
|
|
156
|
-
# Join log entries into a single message
|
|
157
|
-
if isinstance(logs, list):
|
|
158
|
-
message = " | ".join(str(log) for log in logs if log)
|
|
159
|
-
else:
|
|
160
|
-
message = str(logs)
|
|
161
|
-
|
|
162
|
-
if message:
|
|
163
|
-
await context.publish_progress(
|
|
164
|
-
ProgressUpdate(
|
|
165
|
-
job_id=handler.request_id,
|
|
166
|
-
status="processing",
|
|
167
|
-
progress=50.0,
|
|
168
|
-
phase="processing",
|
|
169
|
-
message=message,
|
|
170
|
-
)
|
|
171
|
-
)
|
|
172
|
-
|
|
173
|
-
# Get final result
|
|
174
|
-
result = await handler.get()
|
|
175
|
-
|
|
176
|
-
# Extract audio URL from result
|
|
177
|
-
# fal.ai returns: {"audio": {"url": "...", "content_type": "...", ...}}
|
|
178
|
-
audio_data = result.get("audio")
|
|
179
|
-
if audio_data is None:
|
|
180
|
-
raise ValueError("No audio data returned from fal.ai API")
|
|
181
|
-
|
|
182
|
-
audio_url = audio_data.get("url")
|
|
183
|
-
if not audio_url:
|
|
184
|
-
raise ValueError("Audio URL missing in fal.ai response")
|
|
185
|
-
|
|
186
|
-
# Store audio result
|
|
187
|
-
artifact = await context.store_audio_result(
|
|
188
|
-
storage_url=audio_url,
|
|
189
|
-
format="mp3", # ElevenLabs TTS returns MP3 format
|
|
190
|
-
output_index=0,
|
|
191
|
-
)
|
|
192
|
-
|
|
193
|
-
return GeneratorResult(outputs=[artifact])
|
|
194
|
-
|
|
195
|
-
async def estimate_cost(self, inputs: FalElevenlabsTtsTurboV25Input) -> float:
|
|
196
|
-
"""Estimate cost for ElevenLabs TTS Turbo v2.5 generation.
|
|
197
|
-
|
|
198
|
-
ElevenLabs TTS Turbo v2.5 pricing is typically based on character count.
|
|
199
|
-
Using a conservative estimate of $0.001 per character for turbo models.
|
|
200
|
-
"""
|
|
201
|
-
# Calculate character count
|
|
202
|
-
char_count = len(inputs.text)
|
|
203
|
-
|
|
204
|
-
# Estimated cost: $0.001 per character (adjust based on actual pricing)
|
|
205
|
-
# This is a placeholder - actual pricing should be verified
|
|
206
|
-
return char_count * 0.001
|
package/templates/api/src/boards/generators/implementations/fal/audio/fal_minimax_speech_26_hd.py
DELETED
|
@@ -1,237 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Text-to-speech generation using Minimax Speech 2.6-HD.
|
|
3
|
-
|
|
4
|
-
Based on Fal AI's fal-ai/minimax/speech-2.6-hd model.
|
|
5
|
-
See: https://fal.ai/models/fal-ai/minimax/speech-2.6-hd
|
|
6
|
-
"""
|
|
7
|
-
|
|
8
|
-
import os
|
|
9
|
-
from typing import Literal
|
|
10
|
-
|
|
11
|
-
from pydantic import BaseModel, Field
|
|
12
|
-
|
|
13
|
-
from ....base import BaseGenerator, GeneratorExecutionContext, GeneratorResult
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
class VoiceSetting(BaseModel):
|
|
17
|
-
"""Voice settings for speech synthesis."""
|
|
18
|
-
|
|
19
|
-
voice_id: str = Field(
|
|
20
|
-
default="Wise_Woman",
|
|
21
|
-
description="Voice ID from predefined voices (e.g., Wise_Woman, Young_Man, etc.)",
|
|
22
|
-
)
|
|
23
|
-
speed: float = Field(
|
|
24
|
-
default=1.0,
|
|
25
|
-
ge=0.5,
|
|
26
|
-
le=2.0,
|
|
27
|
-
description="Speech speed multiplier (0.5-2.0)",
|
|
28
|
-
)
|
|
29
|
-
vol: float = Field(
|
|
30
|
-
default=1.0,
|
|
31
|
-
ge=0.01,
|
|
32
|
-
le=10.0,
|
|
33
|
-
description="Volume level (0.01-10)",
|
|
34
|
-
)
|
|
35
|
-
pitch: int = Field(
|
|
36
|
-
default=0,
|
|
37
|
-
ge=-12,
|
|
38
|
-
le=12,
|
|
39
|
-
description="Pitch adjustment in semitones (-12 to 12)",
|
|
40
|
-
)
|
|
41
|
-
emotion: str | None = Field(
|
|
42
|
-
default=None,
|
|
43
|
-
description=(
|
|
44
|
-
"Emotion for speech (happy, sad, angry, fearful, disgusted, surprised, neutral)"
|
|
45
|
-
),
|
|
46
|
-
)
|
|
47
|
-
english_normalization: bool = Field(
|
|
48
|
-
default=False,
|
|
49
|
-
description="Enable English text normalization",
|
|
50
|
-
)
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
class AudioSetting(BaseModel):
|
|
54
|
-
"""Audio output settings."""
|
|
55
|
-
|
|
56
|
-
format: Literal["mp3", "pcm", "flac"] = Field(
|
|
57
|
-
default="mp3",
|
|
58
|
-
description="Output audio format",
|
|
59
|
-
)
|
|
60
|
-
sample_rate: Literal[8000, 16000, 22050, 24000, 32000, 44100] = Field(
|
|
61
|
-
default=32000,
|
|
62
|
-
description="Sample rate in Hz",
|
|
63
|
-
)
|
|
64
|
-
channel: Literal[1, 2] = Field(
|
|
65
|
-
default=1,
|
|
66
|
-
description="Number of audio channels (1=mono, 2=stereo)",
|
|
67
|
-
)
|
|
68
|
-
bitrate: Literal[32000, 64000, 128000, 256000] = Field(
|
|
69
|
-
default=128000,
|
|
70
|
-
description="Audio bitrate in bits per second",
|
|
71
|
-
)
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
class NormalizationSetting(BaseModel):
|
|
75
|
-
"""Audio normalization settings."""
|
|
76
|
-
|
|
77
|
-
enabled: bool = Field(
|
|
78
|
-
default=True,
|
|
79
|
-
description="Enable audio normalization",
|
|
80
|
-
)
|
|
81
|
-
target_loudness: float = Field(
|
|
82
|
-
default=-18.0,
|
|
83
|
-
ge=-70.0,
|
|
84
|
-
le=-10.0,
|
|
85
|
-
description="Target loudness in LUFS (-70 to -10)",
|
|
86
|
-
)
|
|
87
|
-
target_range: float = Field(
|
|
88
|
-
default=8.0,
|
|
89
|
-
ge=0.0,
|
|
90
|
-
le=20.0,
|
|
91
|
-
description="Target loudness range in LU (0-20)",
|
|
92
|
-
)
|
|
93
|
-
target_peak: float = Field(
|
|
94
|
-
default=-0.5,
|
|
95
|
-
ge=-3.0,
|
|
96
|
-
le=0.0,
|
|
97
|
-
description="Target peak level in dBTP (-3 to 0)",
|
|
98
|
-
)
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
class FalMinimaxSpeech26HdInput(BaseModel):
|
|
102
|
-
"""Input schema for Fal Minimax Speech 2.6-HD generator."""
|
|
103
|
-
|
|
104
|
-
prompt: str = Field(
|
|
105
|
-
description=(
|
|
106
|
-
"Text to convert to speech. Paragraph breaks should be marked with newline characters."
|
|
107
|
-
),
|
|
108
|
-
min_length=1,
|
|
109
|
-
max_length=10000,
|
|
110
|
-
)
|
|
111
|
-
language_boost: str | None = Field(
|
|
112
|
-
default=None,
|
|
113
|
-
description=(
|
|
114
|
-
"Language boost option. Supports: Chinese, English, Arabic, Russian, Spanish, "
|
|
115
|
-
"French, Portuguese, German, Turkish, Dutch, Ukrainian, Vietnamese, Indonesian, "
|
|
116
|
-
"Japanese, Italian, Korean, Thai, Polish, Romanian, Greek, Czech, Finnish, Hindi, "
|
|
117
|
-
"Bulgarian, Danish, Hebrew, Malay, Slovak, Swedish, Croatian, Hungarian, "
|
|
118
|
-
"Norwegian, Slovenian, Catalan, Nynorsk, Afrikaans"
|
|
119
|
-
),
|
|
120
|
-
)
|
|
121
|
-
output_format: Literal["hex", "url"] = Field(
|
|
122
|
-
default="url",
|
|
123
|
-
description=(
|
|
124
|
-
"Output format for audio data (url returns a downloadable link, hex returns raw data)"
|
|
125
|
-
),
|
|
126
|
-
)
|
|
127
|
-
voice_setting: VoiceSetting = Field(
|
|
128
|
-
default_factory=VoiceSetting,
|
|
129
|
-
description="Voice customization settings",
|
|
130
|
-
)
|
|
131
|
-
audio_setting: AudioSetting = Field(
|
|
132
|
-
default_factory=AudioSetting,
|
|
133
|
-
description="Audio output format settings",
|
|
134
|
-
)
|
|
135
|
-
normalization_setting: NormalizationSetting = Field(
|
|
136
|
-
default_factory=NormalizationSetting,
|
|
137
|
-
description="Audio normalization settings",
|
|
138
|
-
)
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
class FalMinimaxSpeech26HdGenerator(BaseGenerator):
|
|
142
|
-
"""Generator for text-to-speech using Minimax Speech 2.6-HD."""
|
|
143
|
-
|
|
144
|
-
name = "fal-minimax-speech-26-hd"
|
|
145
|
-
description = (
|
|
146
|
-
"High-quality text-to-speech generation with extensive voice customization options"
|
|
147
|
-
)
|
|
148
|
-
artifact_type = "audio"
|
|
149
|
-
|
|
150
|
-
def get_input_schema(self) -> type[FalMinimaxSpeech26HdInput]:
|
|
151
|
-
"""Return the input schema for this generator."""
|
|
152
|
-
return FalMinimaxSpeech26HdInput
|
|
153
|
-
|
|
154
|
-
async def generate(
|
|
155
|
-
self, inputs: FalMinimaxSpeech26HdInput, context: GeneratorExecutionContext
|
|
156
|
-
) -> GeneratorResult:
|
|
157
|
-
"""Generate audio using fal.ai minimax/speech-2.6-hd."""
|
|
158
|
-
# Check for API key
|
|
159
|
-
if not os.getenv("FAL_KEY"):
|
|
160
|
-
raise ValueError("API configuration invalid. Missing FAL_KEY environment variable")
|
|
161
|
-
|
|
162
|
-
# Import fal_client
|
|
163
|
-
try:
|
|
164
|
-
import fal_client
|
|
165
|
-
except ImportError as e:
|
|
166
|
-
raise ImportError(
|
|
167
|
-
"fal.ai SDK is required for FalMinimaxSpeech26HdGenerator. "
|
|
168
|
-
"Install with: pip install weirdfingers-boards[generators-fal]"
|
|
169
|
-
) from e
|
|
170
|
-
|
|
171
|
-
# Prepare arguments for fal.ai API
|
|
172
|
-
arguments: dict = {
|
|
173
|
-
"prompt": inputs.prompt,
|
|
174
|
-
"output_format": inputs.output_format,
|
|
175
|
-
"voice_setting": inputs.voice_setting.model_dump(exclude_none=True),
|
|
176
|
-
"audio_setting": inputs.audio_setting.model_dump(),
|
|
177
|
-
"normalization_setting": inputs.normalization_setting.model_dump(),
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
# Only add language_boost if specified
|
|
181
|
-
if inputs.language_boost:
|
|
182
|
-
arguments["language_boost"] = inputs.language_boost
|
|
183
|
-
|
|
184
|
-
# Submit async job
|
|
185
|
-
handler = await fal_client.submit_async(
|
|
186
|
-
"fal-ai/minimax/speech-2.6-hd",
|
|
187
|
-
arguments=arguments,
|
|
188
|
-
)
|
|
189
|
-
|
|
190
|
-
# Store external job ID
|
|
191
|
-
await context.set_external_job_id(handler.request_id)
|
|
192
|
-
|
|
193
|
-
# Stream progress updates
|
|
194
|
-
from .....progress.models import ProgressUpdate
|
|
195
|
-
|
|
196
|
-
event_count = 0
|
|
197
|
-
async for _event in handler.iter_events(with_logs=True):
|
|
198
|
-
event_count += 1
|
|
199
|
-
# Sample every 3rd event to avoid spam
|
|
200
|
-
if event_count % 3 == 0:
|
|
201
|
-
await context.publish_progress(
|
|
202
|
-
ProgressUpdate(
|
|
203
|
-
job_id=handler.request_id,
|
|
204
|
-
status="processing",
|
|
205
|
-
progress=50.0,
|
|
206
|
-
phase="processing",
|
|
207
|
-
)
|
|
208
|
-
)
|
|
209
|
-
|
|
210
|
-
# Get final result
|
|
211
|
-
result = await handler.get()
|
|
212
|
-
|
|
213
|
-
# Extract audio output
|
|
214
|
-
audio_data = result.get("audio")
|
|
215
|
-
if audio_data is None:
|
|
216
|
-
raise ValueError("No audio data returned from API")
|
|
217
|
-
|
|
218
|
-
if not isinstance(audio_data, dict):
|
|
219
|
-
raise ValueError(f"Unexpected audio data type: {type(audio_data)}")
|
|
220
|
-
|
|
221
|
-
audio_url = audio_data.get("url")
|
|
222
|
-
if not audio_url:
|
|
223
|
-
raise ValueError("Audio URL missing")
|
|
224
|
-
|
|
225
|
-
artifact = await context.store_audio_result(
|
|
226
|
-
storage_url=audio_url,
|
|
227
|
-
format=inputs.audio_setting.format,
|
|
228
|
-
output_index=0,
|
|
229
|
-
)
|
|
230
|
-
|
|
231
|
-
return GeneratorResult(outputs=[artifact])
|
|
232
|
-
|
|
233
|
-
async def estimate_cost(self, inputs: FalMinimaxSpeech26HdInput) -> float:
|
|
234
|
-
"""Estimate cost for this generation in USD."""
|
|
235
|
-
# Minimax Speech 2.6-HD pricing (estimated at $0.015 per generation)
|
|
236
|
-
# This is a reasonable estimate for TTS models
|
|
237
|
-
return 0.015
|
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
fal.ai minimax-music/v2 text-to-music generator.
|
|
3
|
-
|
|
4
|
-
Generate music from text prompts using the MiniMax Music 2.0 model, which leverages
|
|
5
|
-
advanced AI techniques to create high-quality, diverse musical compositions.
|
|
6
|
-
|
|
7
|
-
Based on Fal AI's fal-ai/minimax-music/v2 model.
|
|
8
|
-
See: https://fal.ai/models/fal-ai/minimax-music/v2
|
|
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 AudioSetting(BaseModel):
|
|
20
|
-
"""Audio output settings for minimax-music/v2."""
|
|
21
|
-
|
|
22
|
-
format: Literal["mp3", "pcm", "flac"] = Field(
|
|
23
|
-
default="mp3",
|
|
24
|
-
description="Audio output format",
|
|
25
|
-
)
|
|
26
|
-
sample_rate: Literal[8000, 16000, 22050, 24000, 32000, 44100] = Field(
|
|
27
|
-
default=44100,
|
|
28
|
-
description="Audio sample rate in Hz",
|
|
29
|
-
)
|
|
30
|
-
bitrate: Literal[32000, 64000, 128000, 256000] = Field(
|
|
31
|
-
default=256000,
|
|
32
|
-
description="Audio bitrate in bits per second",
|
|
33
|
-
)
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
class MinimaxMusicV2Input(BaseModel):
|
|
37
|
-
"""Input schema for minimax-music/v2 music generation."""
|
|
38
|
-
|
|
39
|
-
prompt: str = Field(
|
|
40
|
-
description="A description of the music, specifying style, mood, and scenario",
|
|
41
|
-
min_length=10,
|
|
42
|
-
max_length=300,
|
|
43
|
-
)
|
|
44
|
-
lyrics_prompt: str = Field(
|
|
45
|
-
description=(
|
|
46
|
-
"Lyrics of the song. Use \\n to separate lines. "
|
|
47
|
-
"Structure tags like [Intro], [Verse], [Chorus] supported"
|
|
48
|
-
),
|
|
49
|
-
min_length=10,
|
|
50
|
-
max_length=3000,
|
|
51
|
-
)
|
|
52
|
-
audio_setting: AudioSetting | None = Field(
|
|
53
|
-
default=None,
|
|
54
|
-
description="Audio output settings (format, sample rate, bitrate)",
|
|
55
|
-
)
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
class FalMinimaxMusicV2Generator(BaseGenerator):
|
|
59
|
-
"""minimax-music/v2 music generator using fal.ai."""
|
|
60
|
-
|
|
61
|
-
name = "fal-minimax-music-v2"
|
|
62
|
-
artifact_type = "audio"
|
|
63
|
-
description = "Fal: MiniMax Music 2.0 - generate music from text prompts and lyrics"
|
|
64
|
-
|
|
65
|
-
def get_input_schema(self) -> type[MinimaxMusicV2Input]:
|
|
66
|
-
return MinimaxMusicV2Input
|
|
67
|
-
|
|
68
|
-
async def generate(
|
|
69
|
-
self, inputs: MinimaxMusicV2Input, context: GeneratorExecutionContext
|
|
70
|
-
) -> GeneratorResult:
|
|
71
|
-
"""Generate music using fal.ai minimax-music/v2 model."""
|
|
72
|
-
# Check for API key (fal-client uses FAL_KEY environment variable)
|
|
73
|
-
if not os.getenv("FAL_KEY"):
|
|
74
|
-
raise ValueError("API configuration invalid. Missing FAL_KEY environment variable")
|
|
75
|
-
|
|
76
|
-
# Import fal_client
|
|
77
|
-
try:
|
|
78
|
-
import fal_client
|
|
79
|
-
except ImportError as e:
|
|
80
|
-
raise ImportError(
|
|
81
|
-
"fal.ai SDK is required for FalMinimaxMusicV2Generator. "
|
|
82
|
-
"Install with: pip install weirdfingers-boards[generators-fal]"
|
|
83
|
-
) from e
|
|
84
|
-
|
|
85
|
-
# Prepare arguments for fal.ai API
|
|
86
|
-
from typing import Any
|
|
87
|
-
|
|
88
|
-
arguments: dict[str, Any] = {
|
|
89
|
-
"prompt": inputs.prompt,
|
|
90
|
-
"lyrics_prompt": inputs.lyrics_prompt,
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
# Add audio settings if provided
|
|
94
|
-
if inputs.audio_setting is not None:
|
|
95
|
-
arguments["audio_setting"] = {
|
|
96
|
-
"format": inputs.audio_setting.format,
|
|
97
|
-
"sample_rate": inputs.audio_setting.sample_rate,
|
|
98
|
-
"bitrate": inputs.audio_setting.bitrate,
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
# Submit async job and get handler
|
|
102
|
-
handler = await fal_client.submit_async(
|
|
103
|
-
"fal-ai/minimax-music/v2",
|
|
104
|
-
arguments=arguments,
|
|
105
|
-
)
|
|
106
|
-
|
|
107
|
-
# Store the external job ID for tracking
|
|
108
|
-
await context.set_external_job_id(handler.request_id)
|
|
109
|
-
|
|
110
|
-
# Stream progress updates (sample every 3rd event to avoid spam)
|
|
111
|
-
from .....progress.models import ProgressUpdate
|
|
112
|
-
|
|
113
|
-
event_count = 0
|
|
114
|
-
async for event in handler.iter_events(with_logs=True):
|
|
115
|
-
event_count += 1
|
|
116
|
-
|
|
117
|
-
# Process every 3rd event to provide feedback without overwhelming
|
|
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 audio from result
|
|
143
|
-
# fal.ai returns: {"audio": {"url": "...", "content_type": "...", "file_size": ...}}
|
|
144
|
-
audio_data = result.get("audio")
|
|
145
|
-
if not audio_data:
|
|
146
|
-
raise ValueError("No audio returned from fal.ai API")
|
|
147
|
-
|
|
148
|
-
audio_url = audio_data.get("url")
|
|
149
|
-
if not audio_url:
|
|
150
|
-
raise ValueError("Audio missing URL in fal.ai response")
|
|
151
|
-
|
|
152
|
-
# Determine format from audio_setting or content_type
|
|
153
|
-
audio_format = (
|
|
154
|
-
inputs.audio_setting.format if inputs.audio_setting else "mp3" # Default format
|
|
155
|
-
)
|
|
156
|
-
|
|
157
|
-
# Store audio result
|
|
158
|
-
artifact = await context.store_audio_result(
|
|
159
|
-
storage_url=audio_url,
|
|
160
|
-
format=audio_format,
|
|
161
|
-
sample_rate=inputs.audio_setting.sample_rate if inputs.audio_setting else 44100,
|
|
162
|
-
output_index=0,
|
|
163
|
-
)
|
|
164
|
-
|
|
165
|
-
return GeneratorResult(outputs=[artifact])
|
|
166
|
-
|
|
167
|
-
async def estimate_cost(self, inputs: MinimaxMusicV2Input) -> float:
|
|
168
|
-
"""Estimate cost for minimax-music/v2 generation.
|
|
169
|
-
|
|
170
|
-
Estimated at approximately $0.08 per music generation based on typical
|
|
171
|
-
music generation pricing. Actual cost may vary.
|
|
172
|
-
"""
|
|
173
|
-
return 0.08 # $0.08 per music generation
|