magic_hour 0.9.5__py3-none-any.whl → 0.44.0__py3-none-any.whl
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.
- magic_hour/README.md +34 -0
- magic_hour/__init__.py +1 -1
- magic_hour/client.py +8 -17
- magic_hour/environment.py +13 -1
- magic_hour/helpers/__init__.py +4 -0
- magic_hour/helpers/download.py +77 -0
- magic_hour/helpers/logger.py +8 -0
- magic_hour/resources/v1/README.md +32 -0
- magic_hour/resources/v1/ai_clothes_changer/README.md +94 -5
- magic_hour/resources/v1/ai_clothes_changer/client.py +161 -16
- magic_hour/resources/v1/ai_face_editor/README.md +195 -0
- magic_hour/resources/v1/ai_face_editor/__init__.py +4 -0
- magic_hour/resources/v1/ai_face_editor/client.py +324 -0
- magic_hour/resources/v1/ai_gif_generator/README.md +116 -0
- magic_hour/resources/v1/ai_gif_generator/__init__.py +4 -0
- magic_hour/resources/v1/ai_gif_generator/client.py +257 -0
- magic_hour/resources/v1/ai_headshot_generator/README.md +81 -3
- magic_hour/resources/v1/ai_headshot_generator/client.py +167 -18
- magic_hour/resources/v1/ai_image_editor/README.md +125 -0
- magic_hour/resources/v1/ai_image_editor/__init__.py +4 -0
- magic_hour/resources/v1/ai_image_editor/client.py +290 -0
- magic_hour/resources/v1/ai_image_generator/README.md +99 -5
- magic_hour/resources/v1/ai_image_generator/client.py +170 -24
- magic_hour/resources/v1/ai_image_upscaler/README.md +89 -3
- magic_hour/resources/v1/ai_image_upscaler/client.py +173 -20
- magic_hour/resources/v1/ai_meme_generator/README.md +129 -0
- magic_hour/resources/v1/ai_meme_generator/__init__.py +4 -0
- magic_hour/resources/v1/ai_meme_generator/client.py +253 -0
- magic_hour/resources/v1/ai_photo_editor/README.md +119 -4
- magic_hour/resources/v1/ai_photo_editor/client.py +199 -18
- magic_hour/resources/v1/ai_qr_code_generator/README.md +84 -3
- magic_hour/resources/v1/ai_qr_code_generator/client.py +140 -18
- magic_hour/resources/v1/ai_talking_photo/README.md +137 -0
- magic_hour/resources/v1/ai_talking_photo/__init__.py +4 -0
- magic_hour/resources/v1/ai_talking_photo/client.py +326 -0
- magic_hour/resources/v1/ai_voice_cloner/README.md +62 -0
- magic_hour/resources/v1/ai_voice_cloner/__init__.py +4 -0
- magic_hour/resources/v1/ai_voice_cloner/client.py +272 -0
- magic_hour/resources/v1/ai_voice_generator/README.md +112 -0
- magic_hour/resources/v1/ai_voice_generator/__init__.py +4 -0
- magic_hour/resources/v1/ai_voice_generator/client.py +241 -0
- magic_hour/resources/v1/animation/README.md +128 -6
- magic_hour/resources/v1/animation/client.py +247 -22
- magic_hour/resources/v1/audio_projects/README.md +135 -0
- magic_hour/resources/v1/audio_projects/__init__.py +12 -0
- magic_hour/resources/v1/audio_projects/client.py +310 -0
- magic_hour/resources/v1/audio_projects/client_test.py +520 -0
- magic_hour/resources/v1/auto_subtitle_generator/README.md +128 -0
- magic_hour/resources/v1/auto_subtitle_generator/__init__.py +4 -0
- magic_hour/resources/v1/auto_subtitle_generator/client.py +346 -0
- magic_hour/resources/v1/client.py +75 -1
- magic_hour/resources/v1/face_detection/README.md +157 -0
- magic_hour/resources/v1/face_detection/__init__.py +12 -0
- magic_hour/resources/v1/face_detection/client.py +380 -0
- magic_hour/resources/v1/face_swap/README.md +137 -9
- magic_hour/resources/v1/face_swap/client.py +329 -38
- magic_hour/resources/v1/face_swap_photo/README.md +118 -3
- magic_hour/resources/v1/face_swap_photo/client.py +199 -14
- magic_hour/resources/v1/files/README.md +39 -0
- magic_hour/resources/v1/files/client.py +351 -1
- magic_hour/resources/v1/files/client_test.py +414 -0
- magic_hour/resources/v1/files/upload_urls/README.md +38 -17
- magic_hour/resources/v1/files/upload_urls/client.py +38 -34
- magic_hour/resources/v1/image_background_remover/README.md +96 -5
- magic_hour/resources/v1/image_background_remover/client.py +151 -16
- magic_hour/resources/v1/image_projects/README.md +82 -10
- magic_hour/resources/v1/image_projects/__init__.py +10 -2
- magic_hour/resources/v1/image_projects/client.py +154 -16
- magic_hour/resources/v1/image_projects/client_test.py +527 -0
- magic_hour/resources/v1/image_to_video/README.md +96 -11
- magic_hour/resources/v1/image_to_video/client.py +282 -38
- magic_hour/resources/v1/lip_sync/README.md +112 -9
- magic_hour/resources/v1/lip_sync/client.py +288 -34
- magic_hour/resources/v1/photo_colorizer/README.md +107 -0
- magic_hour/resources/v1/photo_colorizer/__init__.py +4 -0
- magic_hour/resources/v1/photo_colorizer/client.py +248 -0
- magic_hour/resources/v1/text_to_video/README.md +96 -7
- magic_hour/resources/v1/text_to_video/client.py +204 -18
- magic_hour/resources/v1/video_projects/README.md +81 -9
- magic_hour/resources/v1/video_projects/__init__.py +10 -2
- magic_hour/resources/v1/video_projects/client.py +151 -14
- magic_hour/resources/v1/video_projects/client_test.py +527 -0
- magic_hour/resources/v1/video_to_video/README.md +119 -15
- magic_hour/resources/v1/video_to_video/client.py +299 -46
- magic_hour/types/models/__init__.py +92 -56
- magic_hour/types/models/v1_ai_clothes_changer_create_response.py +33 -0
- magic_hour/types/models/v1_ai_face_editor_create_response.py +33 -0
- magic_hour/types/models/v1_ai_gif_generator_create_response.py +33 -0
- magic_hour/types/models/v1_ai_headshot_generator_create_response.py +33 -0
- magic_hour/types/models/v1_ai_image_editor_create_response.py +33 -0
- magic_hour/types/models/v1_ai_image_generator_create_response.py +33 -0
- magic_hour/types/models/v1_ai_image_upscaler_create_response.py +33 -0
- magic_hour/types/models/v1_ai_meme_generator_create_response.py +33 -0
- magic_hour/types/models/v1_ai_photo_editor_create_response.py +33 -0
- magic_hour/types/models/v1_ai_qr_code_generator_create_response.py +33 -0
- magic_hour/types/models/v1_ai_talking_photo_create_response.py +35 -0
- magic_hour/types/models/v1_ai_voice_cloner_create_response.py +27 -0
- magic_hour/types/models/v1_ai_voice_generator_create_response.py +27 -0
- magic_hour/types/models/v1_animation_create_response.py +35 -0
- magic_hour/types/models/v1_audio_projects_get_response.py +72 -0
- magic_hour/types/models/v1_audio_projects_get_response_downloads_item.py +19 -0
- magic_hour/types/models/{get_v1_image_projects_id_response_error.py → v1_audio_projects_get_response_error.py} +2 -2
- magic_hour/types/models/v1_auto_subtitle_generator_create_response.py +35 -0
- magic_hour/types/models/v1_face_detection_create_response.py +25 -0
- magic_hour/types/models/v1_face_detection_get_response.py +45 -0
- magic_hour/types/models/v1_face_detection_get_response_faces_item.py +25 -0
- magic_hour/types/models/v1_face_swap_create_response.py +35 -0
- magic_hour/types/models/v1_face_swap_photo_create_response.py +33 -0
- magic_hour/types/models/v1_files_upload_urls_create_response.py +24 -0
- magic_hour/types/models/{post_v1_files_upload_urls_response_items_item.py → v1_files_upload_urls_create_response_items_item.py} +2 -2
- magic_hour/types/models/v1_image_background_remover_create_response.py +33 -0
- magic_hour/types/models/{get_v1_image_projects_id_response.py → v1_image_projects_get_response.py} +20 -18
- magic_hour/types/models/{get_v1_video_projects_id_response_downloads_item.py → v1_image_projects_get_response_downloads_item.py} +1 -1
- magic_hour/types/models/{get_v1_video_projects_id_response_error.py → v1_image_projects_get_response_error.py} +2 -2
- magic_hour/types/models/v1_image_to_video_create_response.py +35 -0
- magic_hour/types/models/v1_lip_sync_create_response.py +35 -0
- magic_hour/types/models/v1_photo_colorizer_create_response.py +33 -0
- magic_hour/types/models/v1_text_to_video_create_response.py +35 -0
- magic_hour/types/models/{get_v1_video_projects_id_response.py → v1_video_projects_get_response.py} +26 -23
- magic_hour/types/models/{get_v1_video_projects_id_response_download.py → v1_video_projects_get_response_download.py} +1 -1
- magic_hour/types/models/{get_v1_image_projects_id_response_downloads_item.py → v1_video_projects_get_response_downloads_item.py} +1 -1
- magic_hour/types/models/v1_video_projects_get_response_error.py +25 -0
- magic_hour/types/models/v1_video_to_video_create_response.py +35 -0
- magic_hour/types/params/__init__.py +422 -176
- magic_hour/types/params/v1_ai_clothes_changer_create_body.py +40 -0
- magic_hour/types/params/v1_ai_clothes_changer_create_body_assets.py +58 -0
- magic_hour/types/params/v1_ai_clothes_changer_generate_body_assets.py +33 -0
- magic_hour/types/params/v1_ai_face_editor_create_body.py +52 -0
- magic_hour/types/params/v1_ai_face_editor_create_body_assets.py +33 -0
- magic_hour/types/params/v1_ai_face_editor_create_body_style.py +137 -0
- magic_hour/types/params/v1_ai_face_editor_generate_body_assets.py +17 -0
- magic_hour/types/params/v1_ai_gif_generator_create_body.py +47 -0
- magic_hour/types/params/{post_v1_ai_image_generator_body_style.py → v1_ai_gif_generator_create_body_style.py} +5 -5
- magic_hour/types/params/v1_ai_headshot_generator_create_body.py +49 -0
- magic_hour/types/params/v1_ai_headshot_generator_create_body_assets.py +33 -0
- magic_hour/types/params/v1_ai_headshot_generator_create_body_style.py +27 -0
- magic_hour/types/params/v1_ai_headshot_generator_generate_body_assets.py +17 -0
- magic_hour/types/params/v1_ai_image_editor_create_body.py +49 -0
- magic_hour/types/params/v1_ai_image_editor_create_body_assets.py +47 -0
- magic_hour/types/params/v1_ai_image_editor_create_body_style.py +41 -0
- magic_hour/types/params/v1_ai_image_editor_generate_body_assets.py +28 -0
- magic_hour/types/params/{post_v1_ai_image_generator_body.py → v1_ai_image_generator_create_body.py} +17 -11
- magic_hour/types/params/v1_ai_image_generator_create_body_style.py +127 -0
- magic_hour/types/params/v1_ai_image_upscaler_create_body.py +59 -0
- magic_hour/types/params/v1_ai_image_upscaler_create_body_assets.py +33 -0
- magic_hour/types/params/{post_v1_ai_image_upscaler_body_style.py → v1_ai_image_upscaler_create_body_style.py} +4 -4
- magic_hour/types/params/v1_ai_image_upscaler_generate_body_assets.py +17 -0
- magic_hour/types/params/v1_ai_meme_generator_create_body.py +37 -0
- magic_hour/types/params/v1_ai_meme_generator_create_body_style.py +73 -0
- magic_hour/types/params/{post_v1_ai_photo_editor_body.py → v1_ai_photo_editor_create_body.py} +15 -15
- magic_hour/types/params/v1_ai_photo_editor_create_body_assets.py +33 -0
- magic_hour/types/params/{post_v1_ai_photo_editor_body_style.py → v1_ai_photo_editor_create_body_style.py} +20 -4
- magic_hour/types/params/v1_ai_photo_editor_generate_body_assets.py +17 -0
- magic_hour/types/params/v1_ai_qr_code_generator_create_body.py +45 -0
- magic_hour/types/params/{post_v1_ai_qr_code_generator_body_style.py → v1_ai_qr_code_generator_create_body_style.py} +4 -4
- magic_hour/types/params/v1_ai_talking_photo_create_body.py +68 -0
- magic_hour/types/params/v1_ai_talking_photo_create_body_assets.py +46 -0
- magic_hour/types/params/v1_ai_talking_photo_create_body_style.py +44 -0
- magic_hour/types/params/v1_ai_talking_photo_generate_body_assets.py +26 -0
- magic_hour/types/params/v1_ai_voice_cloner_create_body.py +49 -0
- magic_hour/types/params/v1_ai_voice_cloner_create_body_assets.py +33 -0
- magic_hour/types/params/v1_ai_voice_cloner_create_body_style.py +28 -0
- magic_hour/types/params/v1_ai_voice_cloner_generate_body_assets.py +28 -0
- magic_hour/types/params/v1_ai_voice_generator_create_body.py +40 -0
- magic_hour/types/params/v1_ai_voice_generator_create_body_style.py +440 -0
- magic_hour/types/params/{post_v1_animation_body.py → v1_animation_create_body.py} +16 -16
- magic_hour/types/params/{post_v1_animation_body_assets.py → v1_animation_create_body_assets.py} +15 -5
- magic_hour/types/params/{post_v1_animation_body_style.py → v1_animation_create_body_style.py} +13 -10
- magic_hour/types/params/v1_animation_generate_body_assets.py +39 -0
- magic_hour/types/params/v1_auto_subtitle_generator_create_body.py +78 -0
- magic_hour/types/params/v1_auto_subtitle_generator_create_body_assets.py +33 -0
- magic_hour/types/params/v1_auto_subtitle_generator_create_body_style.py +56 -0
- magic_hour/types/params/v1_auto_subtitle_generator_create_body_style_custom_config.py +86 -0
- magic_hour/types/params/v1_auto_subtitle_generator_generate_body_assets.py +17 -0
- magic_hour/types/params/v1_face_detection_create_body.py +44 -0
- magic_hour/types/params/v1_face_detection_create_body_assets.py +33 -0
- magic_hour/types/params/v1_face_detection_generate_body_assets.py +17 -0
- magic_hour/types/params/v1_face_swap_create_body.py +92 -0
- magic_hour/types/params/v1_face_swap_create_body_assets.py +91 -0
- magic_hour/types/params/v1_face_swap_create_body_assets_face_mappings_item.py +44 -0
- magic_hour/types/params/v1_face_swap_create_body_style.py +33 -0
- magic_hour/types/params/v1_face_swap_generate_body_assets.py +56 -0
- magic_hour/types/params/v1_face_swap_generate_body_assets_face_mappings_item.py +25 -0
- magic_hour/types/params/v1_face_swap_photo_create_body.py +40 -0
- magic_hour/types/params/v1_face_swap_photo_create_body_assets.py +76 -0
- magic_hour/types/params/v1_face_swap_photo_create_body_assets_face_mappings_item.py +44 -0
- magic_hour/types/params/v1_face_swap_photo_generate_body_assets.py +47 -0
- magic_hour/types/params/v1_face_swap_photo_generate_body_assets_face_mappings_item.py +25 -0
- magic_hour/types/params/v1_files_upload_urls_create_body.py +36 -0
- magic_hour/types/params/v1_files_upload_urls_create_body_items_item.py +38 -0
- magic_hour/types/params/v1_image_background_remover_create_body.py +40 -0
- magic_hour/types/params/v1_image_background_remover_create_body_assets.py +49 -0
- magic_hour/types/params/v1_image_background_remover_generate_body_assets.py +27 -0
- magic_hour/types/params/v1_image_to_video_create_body.py +101 -0
- magic_hour/types/params/v1_image_to_video_create_body_assets.py +33 -0
- magic_hour/types/params/v1_image_to_video_create_body_style.py +53 -0
- magic_hour/types/params/v1_image_to_video_generate_body_assets.py +17 -0
- magic_hour/types/params/v1_lip_sync_create_body.py +100 -0
- magic_hour/types/params/{post_v1_lip_sync_body_assets.py → v1_lip_sync_create_body_assets.py} +15 -5
- magic_hour/types/params/v1_lip_sync_create_body_style.py +37 -0
- magic_hour/types/params/v1_lip_sync_generate_body_assets.py +36 -0
- magic_hour/types/params/v1_photo_colorizer_create_body.py +40 -0
- magic_hour/types/params/v1_photo_colorizer_create_body_assets.py +33 -0
- magic_hour/types/params/v1_photo_colorizer_generate_body_assets.py +17 -0
- magic_hour/types/params/v1_text_to_video_create_body.py +78 -0
- magic_hour/types/params/v1_text_to_video_create_body_style.py +43 -0
- magic_hour/types/params/v1_video_to_video_create_body.py +101 -0
- magic_hour/types/params/{post_v1_video_to_video_body_assets.py → v1_video_to_video_create_body_assets.py} +9 -4
- magic_hour/types/params/{post_v1_video_to_video_body_style.py → v1_video_to_video_create_body_style.py} +68 -26
- magic_hour/types/params/v1_video_to_video_generate_body_assets.py +27 -0
- magic_hour-0.44.0.dist-info/METADATA +328 -0
- magic_hour-0.44.0.dist-info/RECORD +231 -0
- magic_hour/core/__init__.py +0 -52
- magic_hour/core/api_error.py +0 -56
- magic_hour/core/auth.py +0 -314
- magic_hour/core/base_client.py +0 -618
- magic_hour/core/binary_response.py +0 -23
- magic_hour/core/query.py +0 -106
- magic_hour/core/request.py +0 -156
- magic_hour/core/response.py +0 -293
- magic_hour/core/type_utils.py +0 -28
- magic_hour/core/utils.py +0 -55
- magic_hour/types/models/post_v1_ai_clothes_changer_response.py +0 -25
- magic_hour/types/models/post_v1_ai_headshot_generator_response.py +0 -25
- magic_hour/types/models/post_v1_ai_image_generator_response.py +0 -25
- magic_hour/types/models/post_v1_ai_image_upscaler_response.py +0 -25
- magic_hour/types/models/post_v1_ai_photo_editor_response.py +0 -25
- magic_hour/types/models/post_v1_ai_qr_code_generator_response.py +0 -25
- magic_hour/types/models/post_v1_animation_response.py +0 -25
- magic_hour/types/models/post_v1_face_swap_photo_response.py +0 -25
- magic_hour/types/models/post_v1_face_swap_response.py +0 -25
- magic_hour/types/models/post_v1_files_upload_urls_response.py +0 -21
- magic_hour/types/models/post_v1_image_background_remover_response.py +0 -25
- magic_hour/types/models/post_v1_image_to_video_response.py +0 -25
- magic_hour/types/models/post_v1_lip_sync_response.py +0 -25
- magic_hour/types/models/post_v1_text_to_video_response.py +0 -25
- magic_hour/types/models/post_v1_video_to_video_response.py +0 -25
- magic_hour/types/params/post_v1_ai_clothes_changer_body.py +0 -40
- magic_hour/types/params/post_v1_ai_clothes_changer_body_assets.py +0 -45
- magic_hour/types/params/post_v1_ai_headshot_generator_body.py +0 -40
- magic_hour/types/params/post_v1_ai_headshot_generator_body_assets.py +0 -28
- magic_hour/types/params/post_v1_ai_image_upscaler_body.py +0 -57
- magic_hour/types/params/post_v1_ai_image_upscaler_body_assets.py +0 -28
- magic_hour/types/params/post_v1_ai_photo_editor_body_assets.py +0 -28
- magic_hour/types/params/post_v1_ai_qr_code_generator_body.py +0 -45
- magic_hour/types/params/post_v1_face_swap_body.py +0 -72
- magic_hour/types/params/post_v1_face_swap_body_assets.py +0 -52
- magic_hour/types/params/post_v1_face_swap_photo_body.py +0 -40
- magic_hour/types/params/post_v1_face_swap_photo_body_assets.py +0 -36
- magic_hour/types/params/post_v1_files_upload_urls_body.py +0 -31
- magic_hour/types/params/post_v1_files_upload_urls_body_items_item.py +0 -38
- magic_hour/types/params/post_v1_image_background_remover_body.py +0 -40
- magic_hour/types/params/post_v1_image_background_remover_body_assets.py +0 -28
- magic_hour/types/params/post_v1_image_to_video_body.py +0 -73
- magic_hour/types/params/post_v1_image_to_video_body_assets.py +0 -28
- magic_hour/types/params/post_v1_image_to_video_body_style.py +0 -37
- magic_hour/types/params/post_v1_lip_sync_body.py +0 -80
- magic_hour/types/params/post_v1_text_to_video_body.py +0 -57
- magic_hour/types/params/post_v1_text_to_video_body_style.py +0 -28
- magic_hour/types/params/post_v1_video_to_video_body.py +0 -93
- magic_hour-0.9.5.dist-info/METADATA +0 -133
- magic_hour-0.9.5.dist-info/RECORD +0 -132
- {magic_hour-0.9.5.dist-info → magic_hour-0.44.0.dist-info}/LICENSE +0 -0
- {magic_hour-0.9.5.dist-info → magic_hour-0.44.0.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import pydantic
|
|
2
|
+
import typing
|
|
3
|
+
import typing_extensions
|
|
4
|
+
|
|
5
|
+
from .v1_face_swap_generate_body_assets_face_mappings_item import (
|
|
6
|
+
V1FaceSwapGenerateBodyAssetsFaceMappingsItem,
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class V1FaceSwapGenerateBodyAssets(typing_extensions.TypedDict):
|
|
11
|
+
"""
|
|
12
|
+
Provide the assets for face swap. For video, The `video_source` field determines whether `video_file_path` or `youtube_url` field is used
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
face_mappings: typing_extensions.NotRequired[
|
|
16
|
+
typing.List[V1FaceSwapGenerateBodyAssetsFaceMappingsItem]
|
|
17
|
+
]
|
|
18
|
+
"""
|
|
19
|
+
This is the array of face mappings used for multiple face swap. The value is required if `face_swap_mode` is `individual-faces`.
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
face_swap_mode: typing_extensions.NotRequired[
|
|
23
|
+
typing_extensions.Literal["all-faces", "individual-faces"]
|
|
24
|
+
]
|
|
25
|
+
"""
|
|
26
|
+
The mode of face swap.
|
|
27
|
+
* `all-faces` - Swap all faces in the target image or video. `source_file_path` is required.
|
|
28
|
+
* `individual-faces` - Swap individual faces in the target image or video. `source_faces` is required.
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
image_file_path: typing_extensions.NotRequired[str]
|
|
32
|
+
"""
|
|
33
|
+
The path of the input image with the face to be swapped. The value is required if `face_swap_mode` is `all-faces`. This value is either
|
|
34
|
+
- a direct URL to the image file
|
|
35
|
+
- a path to a local file
|
|
36
|
+
|
|
37
|
+
Note: if the path begins with `api-assets`, it will be assumed to already be uploaded to Magic Hour's storage, and will not be uploaded again.
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
video_file_path: typing_extensions.NotRequired[str]
|
|
41
|
+
"""
|
|
42
|
+
Required if `video_source` is `file`. This value is either
|
|
43
|
+
- a direct URL to the image file
|
|
44
|
+
- a path to a local file
|
|
45
|
+
|
|
46
|
+
Note: if the path begins with `api-assets`, it will be assumed to already be uploaded to Magic Hour's storage, and will not be uploaded again.
|
|
47
|
+
"""
|
|
48
|
+
|
|
49
|
+
video_source: typing_extensions.Required[
|
|
50
|
+
typing_extensions.Literal["file", "youtube"]
|
|
51
|
+
]
|
|
52
|
+
|
|
53
|
+
youtube_url: typing_extensions.NotRequired[str]
|
|
54
|
+
"""
|
|
55
|
+
Using a youtube video as the input source. This field is required if `video_source` is `youtube`
|
|
56
|
+
"""
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import pydantic
|
|
2
|
+
import typing_extensions
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class V1FaceSwapGenerateBodyAssetsFaceMappingsItem(typing_extensions.TypedDict):
|
|
6
|
+
"""
|
|
7
|
+
V1FaceSwapGenerateBodyAssetsFaceMappingsItem
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
new_face: typing_extensions.Required[str]
|
|
11
|
+
"""
|
|
12
|
+
The face image that will be used to replace the face in the `original_face`. This value is either
|
|
13
|
+
- a direct URL to the image file
|
|
14
|
+
- a path to a local file
|
|
15
|
+
|
|
16
|
+
Note: if the path begins with `api-assets`, it will be assumed to already be uploaded to Magic Hour's storage, and will not be uploaded again.
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
original_face: typing_extensions.Required[str]
|
|
20
|
+
"""
|
|
21
|
+
The face detected from the image in `target_file_path`. The file name is in the format of `<face_frame>-<face_index>.png`. This value is corresponds to the response in the [face detection API](https://docs.magichour.ai/api-reference/files/get-face-detection-details).
|
|
22
|
+
|
|
23
|
+
* The face_frame is the frame number of the face in the target image. For images, the frame number is always 0.
|
|
24
|
+
* The face_index is the index of the face in the target image, starting from 0 going left to right.
|
|
25
|
+
"""
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import pydantic
|
|
2
|
+
import typing
|
|
3
|
+
import typing_extensions
|
|
4
|
+
|
|
5
|
+
from .v1_face_swap_photo_create_body_assets import (
|
|
6
|
+
V1FaceSwapPhotoCreateBodyAssets,
|
|
7
|
+
_SerializerV1FaceSwapPhotoCreateBodyAssets,
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class V1FaceSwapPhotoCreateBody(typing_extensions.TypedDict):
|
|
12
|
+
"""
|
|
13
|
+
V1FaceSwapPhotoCreateBody
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
assets: typing_extensions.Required[V1FaceSwapPhotoCreateBodyAssets]
|
|
17
|
+
"""
|
|
18
|
+
Provide the assets for face swap photo
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
name: typing_extensions.NotRequired[str]
|
|
22
|
+
"""
|
|
23
|
+
The name of image. This value is mainly used for your own identification of the image.
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class _SerializerV1FaceSwapPhotoCreateBody(pydantic.BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
Serializer for V1FaceSwapPhotoCreateBody handling case conversions
|
|
30
|
+
and file omissions as dictated by the API
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
model_config = pydantic.ConfigDict(
|
|
34
|
+
populate_by_name=True,
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
assets: _SerializerV1FaceSwapPhotoCreateBodyAssets = pydantic.Field(
|
|
38
|
+
alias="assets",
|
|
39
|
+
)
|
|
40
|
+
name: typing.Optional[str] = pydantic.Field(alias="name", default=None)
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import pydantic
|
|
2
|
+
import typing
|
|
3
|
+
import typing_extensions
|
|
4
|
+
|
|
5
|
+
from .v1_face_swap_photo_create_body_assets_face_mappings_item import (
|
|
6
|
+
V1FaceSwapPhotoCreateBodyAssetsFaceMappingsItem,
|
|
7
|
+
_SerializerV1FaceSwapPhotoCreateBodyAssetsFaceMappingsItem,
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class V1FaceSwapPhotoCreateBodyAssets(typing_extensions.TypedDict):
|
|
12
|
+
"""
|
|
13
|
+
Provide the assets for face swap photo
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
face_mappings: typing_extensions.NotRequired[
|
|
17
|
+
typing.List[V1FaceSwapPhotoCreateBodyAssetsFaceMappingsItem]
|
|
18
|
+
]
|
|
19
|
+
"""
|
|
20
|
+
This is the array of face mappings used for multiple face swap. The value is required if `face_swap_mode` is `individual-faces`.
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
face_swap_mode: typing_extensions.NotRequired[
|
|
24
|
+
typing_extensions.Literal["all-faces", "individual-faces"]
|
|
25
|
+
]
|
|
26
|
+
"""
|
|
27
|
+
The mode of face swap.
|
|
28
|
+
* `all-faces` - Swap all faces in the target image or video. `source_file_path` is required.
|
|
29
|
+
* `individual-faces` - Swap individual faces in the target image or video. `source_faces` is required.
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
source_file_path: typing_extensions.NotRequired[str]
|
|
33
|
+
"""
|
|
34
|
+
This is the image from which the face is extracted. The value is required if `face_swap_mode` is `all-faces`.
|
|
35
|
+
|
|
36
|
+
This value is either
|
|
37
|
+
- a direct URL to the video file
|
|
38
|
+
- `file_path` field from the response of the [upload urls API](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls).
|
|
39
|
+
|
|
40
|
+
Please refer to the [Input File documentation](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls#input-file) to learn more.
|
|
41
|
+
|
|
42
|
+
"""
|
|
43
|
+
|
|
44
|
+
target_file_path: typing_extensions.Required[str]
|
|
45
|
+
"""
|
|
46
|
+
This is the image where the face from the source image will be placed. This value is either
|
|
47
|
+
- a direct URL to the video file
|
|
48
|
+
- `file_path` field from the response of the [upload urls API](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls).
|
|
49
|
+
|
|
50
|
+
Please refer to the [Input File documentation](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls#input-file) to learn more.
|
|
51
|
+
|
|
52
|
+
"""
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
class _SerializerV1FaceSwapPhotoCreateBodyAssets(pydantic.BaseModel):
|
|
56
|
+
"""
|
|
57
|
+
Serializer for V1FaceSwapPhotoCreateBodyAssets handling case conversions
|
|
58
|
+
and file omissions as dictated by the API
|
|
59
|
+
"""
|
|
60
|
+
|
|
61
|
+
model_config = pydantic.ConfigDict(
|
|
62
|
+
populate_by_name=True,
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
face_mappings: typing.Optional[
|
|
66
|
+
typing.List[_SerializerV1FaceSwapPhotoCreateBodyAssetsFaceMappingsItem]
|
|
67
|
+
] = pydantic.Field(alias="face_mappings", default=None)
|
|
68
|
+
face_swap_mode: typing.Optional[
|
|
69
|
+
typing_extensions.Literal["all-faces", "individual-faces"]
|
|
70
|
+
] = pydantic.Field(alias="face_swap_mode", default=None)
|
|
71
|
+
source_file_path: typing.Optional[str] = pydantic.Field(
|
|
72
|
+
alias="source_file_path", default=None
|
|
73
|
+
)
|
|
74
|
+
target_file_path: str = pydantic.Field(
|
|
75
|
+
alias="target_file_path",
|
|
76
|
+
)
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import pydantic
|
|
2
|
+
import typing_extensions
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class V1FaceSwapPhotoCreateBodyAssetsFaceMappingsItem(typing_extensions.TypedDict):
|
|
6
|
+
"""
|
|
7
|
+
V1FaceSwapPhotoCreateBodyAssetsFaceMappingsItem
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
new_face: typing_extensions.Required[str]
|
|
11
|
+
"""
|
|
12
|
+
The face image that will be used to replace the face in the `original_face`. This value is either
|
|
13
|
+
- a direct URL to the video file
|
|
14
|
+
- `file_path` field from the response of the [upload urls API](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls).
|
|
15
|
+
|
|
16
|
+
Please refer to the [Input File documentation](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls#input-file) to learn more.
|
|
17
|
+
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
original_face: typing_extensions.Required[str]
|
|
21
|
+
"""
|
|
22
|
+
The face detected from the image in `target_file_path`. The file name is in the format of `<face_frame>-<face_index>.png`. This value is corresponds to the response in the [face detection API](https://docs.magichour.ai/api-reference/files/get-face-detection-details).
|
|
23
|
+
|
|
24
|
+
* The face_frame is the frame number of the face in the target image. For images, the frame number is always 0.
|
|
25
|
+
* The face_index is the index of the face in the target image, starting from 0 going left to right.
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class _SerializerV1FaceSwapPhotoCreateBodyAssetsFaceMappingsItem(pydantic.BaseModel):
|
|
30
|
+
"""
|
|
31
|
+
Serializer for V1FaceSwapPhotoCreateBodyAssetsFaceMappingsItem handling case conversions
|
|
32
|
+
and file omissions as dictated by the API
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
model_config = pydantic.ConfigDict(
|
|
36
|
+
populate_by_name=True,
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
new_face: str = pydantic.Field(
|
|
40
|
+
alias="new_face",
|
|
41
|
+
)
|
|
42
|
+
original_face: str = pydantic.Field(
|
|
43
|
+
alias="original_face",
|
|
44
|
+
)
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import pydantic
|
|
2
|
+
import typing
|
|
3
|
+
import typing_extensions
|
|
4
|
+
|
|
5
|
+
from .v1_face_swap_photo_generate_body_assets_face_mappings_item import (
|
|
6
|
+
V1FaceSwapPhotoGenerateBodyAssetsFaceMappingsItem,
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class V1FaceSwapPhotoGenerateBodyAssets(typing_extensions.TypedDict):
|
|
11
|
+
"""
|
|
12
|
+
Provide the assets for face swap photo
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
face_mappings: typing_extensions.NotRequired[
|
|
16
|
+
typing.List[V1FaceSwapPhotoGenerateBodyAssetsFaceMappingsItem]
|
|
17
|
+
]
|
|
18
|
+
"""
|
|
19
|
+
This is the array of face mappings used for multiple face swap. The value is required if `face_swap_mode` is `individual-faces`.
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
face_swap_mode: typing_extensions.NotRequired[
|
|
23
|
+
typing_extensions.Literal["all-faces", "individual-faces"]
|
|
24
|
+
]
|
|
25
|
+
"""
|
|
26
|
+
The mode of face swap.
|
|
27
|
+
* `all-faces` - Swap all faces in the target image or video. `source_file_path` is required.
|
|
28
|
+
* `individual-faces` - Swap individual faces in the target image or video. `source_faces` is required.
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
source_file_path: typing_extensions.NotRequired[str]
|
|
32
|
+
"""
|
|
33
|
+
This is the image from which the face is extracted. The value is required if `face_swap_mode` is `all-faces`. This value is either
|
|
34
|
+
- a direct URL to the image file
|
|
35
|
+
- a path to a local file
|
|
36
|
+
|
|
37
|
+
Note: if the path begins with `api-assets`, it will be assumed to already be uploaded to Magic Hour's storage, and will not be uploaded again.
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
target_file_path: typing_extensions.Required[str]
|
|
41
|
+
"""
|
|
42
|
+
This is the image where the face from the source image will be placed. This value is either
|
|
43
|
+
- a direct URL to the image file
|
|
44
|
+
- a path to a local file
|
|
45
|
+
|
|
46
|
+
Note: if the path begins with `api-assets`, it will be assumed to already be uploaded to Magic Hour's storage, and will not be uploaded again.
|
|
47
|
+
"""
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import pydantic
|
|
2
|
+
import typing_extensions
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class V1FaceSwapPhotoGenerateBodyAssetsFaceMappingsItem(typing_extensions.TypedDict):
|
|
6
|
+
"""
|
|
7
|
+
V1FaceSwapPhotoGenerateBodyAssetsFaceMappingsItem
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
new_face: typing_extensions.Required[str]
|
|
11
|
+
"""
|
|
12
|
+
The face image that will be used to replace the face in the `original_face`. This value is either
|
|
13
|
+
- a direct URL to the image file
|
|
14
|
+
- a path to a local file
|
|
15
|
+
|
|
16
|
+
Note: if the path begins with `api-assets`, it will be assumed to already be uploaded to Magic Hour's storage, and will not be uploaded again.
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
original_face: typing_extensions.Required[str]
|
|
20
|
+
"""
|
|
21
|
+
The face detected from the image in `target_file_path`. The file name is in the format of `<face_frame>-<face_index>.png`. This value is corresponds to the response in the [face detection API](https://docs.magichour.ai/api-reference/files/get-face-detection-details).
|
|
22
|
+
|
|
23
|
+
* The face_frame is the frame number of the face in the target image. For images, the frame number is always 0.
|
|
24
|
+
* The face_index is the index of the face in the target image, starting from 0 going left to right.
|
|
25
|
+
"""
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import pydantic
|
|
2
|
+
import typing
|
|
3
|
+
import typing_extensions
|
|
4
|
+
|
|
5
|
+
from .v1_files_upload_urls_create_body_items_item import (
|
|
6
|
+
V1FilesUploadUrlsCreateBodyItemsItem,
|
|
7
|
+
_SerializerV1FilesUploadUrlsCreateBodyItemsItem,
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class V1FilesUploadUrlsCreateBody(typing_extensions.TypedDict):
|
|
12
|
+
"""
|
|
13
|
+
V1FilesUploadUrlsCreateBody
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
items: typing_extensions.Required[typing.List[V1FilesUploadUrlsCreateBodyItemsItem]]
|
|
17
|
+
"""
|
|
18
|
+
The list of assets to upload. The response array will match the order of items in the request body.
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class _SerializerV1FilesUploadUrlsCreateBody(pydantic.BaseModel):
|
|
23
|
+
"""
|
|
24
|
+
Serializer for V1FilesUploadUrlsCreateBody handling case conversions
|
|
25
|
+
and file omissions as dictated by the API
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
model_config = pydantic.ConfigDict(
|
|
29
|
+
populate_by_name=True,
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
items: typing.List[_SerializerV1FilesUploadUrlsCreateBodyItemsItem] = (
|
|
33
|
+
pydantic.Field(
|
|
34
|
+
alias="items",
|
|
35
|
+
)
|
|
36
|
+
)
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import pydantic
|
|
2
|
+
import typing_extensions
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class V1FilesUploadUrlsCreateBodyItemsItem(typing_extensions.TypedDict):
|
|
6
|
+
"""
|
|
7
|
+
V1FilesUploadUrlsCreateBodyItemsItem
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
extension: typing_extensions.Required[str]
|
|
11
|
+
"""
|
|
12
|
+
The extension of the file to upload. Do not include the dot (.) before the extension. Possible extensions are mp4,m4v,mov,webm,mp3,wav,aac,flac,webm,png,jpg,jpeg,heic,webp,avif,jp2,tiff,bmp,gif,webp,webm
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
type_: typing_extensions.Required[
|
|
16
|
+
typing_extensions.Literal["audio", "image", "video"]
|
|
17
|
+
]
|
|
18
|
+
"""
|
|
19
|
+
The type of asset to upload. Possible types are video, audio, image
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class _SerializerV1FilesUploadUrlsCreateBodyItemsItem(pydantic.BaseModel):
|
|
24
|
+
"""
|
|
25
|
+
Serializer for V1FilesUploadUrlsCreateBodyItemsItem handling case conversions
|
|
26
|
+
and file omissions as dictated by the API
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
model_config = pydantic.ConfigDict(
|
|
30
|
+
populate_by_name=True,
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
extension: str = pydantic.Field(
|
|
34
|
+
alias="extension",
|
|
35
|
+
)
|
|
36
|
+
type_: typing_extensions.Literal["audio", "image", "video"] = pydantic.Field(
|
|
37
|
+
alias="type",
|
|
38
|
+
)
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import pydantic
|
|
2
|
+
import typing
|
|
3
|
+
import typing_extensions
|
|
4
|
+
|
|
5
|
+
from .v1_image_background_remover_create_body_assets import (
|
|
6
|
+
V1ImageBackgroundRemoverCreateBodyAssets,
|
|
7
|
+
_SerializerV1ImageBackgroundRemoverCreateBodyAssets,
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class V1ImageBackgroundRemoverCreateBody(typing_extensions.TypedDict):
|
|
12
|
+
"""
|
|
13
|
+
V1ImageBackgroundRemoverCreateBody
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
assets: typing_extensions.Required[V1ImageBackgroundRemoverCreateBodyAssets]
|
|
17
|
+
"""
|
|
18
|
+
Provide the assets for background removal
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
name: typing_extensions.NotRequired[str]
|
|
22
|
+
"""
|
|
23
|
+
The name of image. This value is mainly used for your own identification of the image.
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class _SerializerV1ImageBackgroundRemoverCreateBody(pydantic.BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
Serializer for V1ImageBackgroundRemoverCreateBody handling case conversions
|
|
30
|
+
and file omissions as dictated by the API
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
model_config = pydantic.ConfigDict(
|
|
34
|
+
populate_by_name=True,
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
assets: _SerializerV1ImageBackgroundRemoverCreateBodyAssets = pydantic.Field(
|
|
38
|
+
alias="assets",
|
|
39
|
+
)
|
|
40
|
+
name: typing.Optional[str] = pydantic.Field(alias="name", default=None)
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import pydantic
|
|
2
|
+
import typing
|
|
3
|
+
import typing_extensions
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class V1ImageBackgroundRemoverCreateBodyAssets(typing_extensions.TypedDict):
|
|
7
|
+
"""
|
|
8
|
+
Provide the assets for background removal
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
background_image_file_path: typing_extensions.NotRequired[str]
|
|
12
|
+
"""
|
|
13
|
+
The image used as the new background for the image_file_path. This image will be resized to match the image in image_file_path. Please make sure the resolution between the images are similar.
|
|
14
|
+
|
|
15
|
+
This value is either
|
|
16
|
+
- a direct URL to the video file
|
|
17
|
+
- `file_path` field from the response of the [upload urls API](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls).
|
|
18
|
+
|
|
19
|
+
Please refer to the [Input File documentation](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls#input-file) to learn more.
|
|
20
|
+
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
image_file_path: typing_extensions.Required[str]
|
|
24
|
+
"""
|
|
25
|
+
The image to remove the background. This value is either
|
|
26
|
+
- a direct URL to the video file
|
|
27
|
+
- `file_path` field from the response of the [upload urls API](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls).
|
|
28
|
+
|
|
29
|
+
Please refer to the [Input File documentation](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls#input-file) to learn more.
|
|
30
|
+
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class _SerializerV1ImageBackgroundRemoverCreateBodyAssets(pydantic.BaseModel):
|
|
35
|
+
"""
|
|
36
|
+
Serializer for V1ImageBackgroundRemoverCreateBodyAssets handling case conversions
|
|
37
|
+
and file omissions as dictated by the API
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
model_config = pydantic.ConfigDict(
|
|
41
|
+
populate_by_name=True,
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
background_image_file_path: typing.Optional[str] = pydantic.Field(
|
|
45
|
+
alias="background_image_file_path", default=None
|
|
46
|
+
)
|
|
47
|
+
image_file_path: str = pydantic.Field(
|
|
48
|
+
alias="image_file_path",
|
|
49
|
+
)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import pydantic
|
|
2
|
+
import typing
|
|
3
|
+
import typing_extensions
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class V1ImageBackgroundRemoverGenerateBodyAssets(typing_extensions.TypedDict):
|
|
7
|
+
"""
|
|
8
|
+
Provide the assets for background removal
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
background_image_file_path: typing_extensions.NotRequired[str]
|
|
12
|
+
"""
|
|
13
|
+
The image used as the new background for the image_file_path. This image will be resized to match the image in image_file_path. Please make sure the resolution between the images are similar. This value is either
|
|
14
|
+
- a direct URL to the image file
|
|
15
|
+
- a path to a local file
|
|
16
|
+
|
|
17
|
+
Note: if the path begins with `api-assets`, it will be assumed to already be uploaded to Magic Hour's storage, and will not be uploaded again.
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
image_file_path: typing_extensions.Required[str]
|
|
21
|
+
"""
|
|
22
|
+
The image to remove the background. This value is either
|
|
23
|
+
- a direct URL to the image file
|
|
24
|
+
- a path to a local file
|
|
25
|
+
|
|
26
|
+
Note: if the path begins with `api-assets`, it will be assumed to already be uploaded to Magic Hour's storage, and will not be uploaded again.
|
|
27
|
+
"""
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import pydantic
|
|
2
|
+
import typing
|
|
3
|
+
import typing_extensions
|
|
4
|
+
|
|
5
|
+
from .v1_image_to_video_create_body_assets import (
|
|
6
|
+
V1ImageToVideoCreateBodyAssets,
|
|
7
|
+
_SerializerV1ImageToVideoCreateBodyAssets,
|
|
8
|
+
)
|
|
9
|
+
from .v1_image_to_video_create_body_style import (
|
|
10
|
+
V1ImageToVideoCreateBodyStyle,
|
|
11
|
+
_SerializerV1ImageToVideoCreateBodyStyle,
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class V1ImageToVideoCreateBody(typing_extensions.TypedDict):
|
|
16
|
+
"""
|
|
17
|
+
V1ImageToVideoCreateBody
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
assets: typing_extensions.Required[V1ImageToVideoCreateBodyAssets]
|
|
21
|
+
"""
|
|
22
|
+
Provide the assets for image-to-video.
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
end_seconds: typing_extensions.Required[float]
|
|
26
|
+
"""
|
|
27
|
+
The total duration of the output video in seconds.
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
height: typing_extensions.NotRequired[typing.Optional[int]]
|
|
31
|
+
"""
|
|
32
|
+
`height` is deprecated and no longer influences the output video's resolution.
|
|
33
|
+
|
|
34
|
+
Output resolution is determined by the **minimum** of:
|
|
35
|
+
- The resolution of the input video
|
|
36
|
+
- The maximum resolution allowed by your subscription tier. See our [pricing page](https://magichour.ai/pricing) for more details.
|
|
37
|
+
|
|
38
|
+
This field is retained only for backward compatibility and will be removed in a future release.
|
|
39
|
+
"""
|
|
40
|
+
|
|
41
|
+
name: typing_extensions.NotRequired[str]
|
|
42
|
+
"""
|
|
43
|
+
The name of video. This value is mainly used for your own identification of the video.
|
|
44
|
+
"""
|
|
45
|
+
|
|
46
|
+
resolution: typing_extensions.NotRequired[
|
|
47
|
+
typing_extensions.Literal["1080p", "480p", "720p"]
|
|
48
|
+
]
|
|
49
|
+
"""
|
|
50
|
+
Controls the output video resolution. Defaults to `720p` if not specified.
|
|
51
|
+
|
|
52
|
+
480p and 720p are available on Creator, Pro, or Business tiers. However, 1080p require Pro or Business tier.
|
|
53
|
+
|
|
54
|
+
**Options:**
|
|
55
|
+
- `480p` - Supports only 5 or 10 second videos. Output: 24fps. Cost: 120 credits per 5 seconds.
|
|
56
|
+
- `720p` - Supports videos between 5-60 seconds. Output: 30fps. Cost: 300 credits per 5 seconds.
|
|
57
|
+
- `1080p` - Supports videos between 5-60 seconds. Output: 30fps. Cost: 600 credits per 5 seconds.
|
|
58
|
+
"""
|
|
59
|
+
|
|
60
|
+
style: typing_extensions.NotRequired[V1ImageToVideoCreateBodyStyle]
|
|
61
|
+
"""
|
|
62
|
+
Attributed used to dictate the style of the output
|
|
63
|
+
"""
|
|
64
|
+
|
|
65
|
+
width: typing_extensions.NotRequired[typing.Optional[int]]
|
|
66
|
+
"""
|
|
67
|
+
`width` is deprecated and no longer influences the output video's resolution.
|
|
68
|
+
|
|
69
|
+
Output resolution is determined by the **minimum** of:
|
|
70
|
+
- The resolution of the input video
|
|
71
|
+
- The maximum resolution allowed by your subscription tier. See our [pricing page](https://magichour.ai/pricing) for more details.
|
|
72
|
+
|
|
73
|
+
This field is retained only for backward compatibility and will be removed in a future release.
|
|
74
|
+
"""
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
class _SerializerV1ImageToVideoCreateBody(pydantic.BaseModel):
|
|
78
|
+
"""
|
|
79
|
+
Serializer for V1ImageToVideoCreateBody handling case conversions
|
|
80
|
+
and file omissions as dictated by the API
|
|
81
|
+
"""
|
|
82
|
+
|
|
83
|
+
model_config = pydantic.ConfigDict(
|
|
84
|
+
populate_by_name=True,
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
assets: _SerializerV1ImageToVideoCreateBodyAssets = pydantic.Field(
|
|
88
|
+
alias="assets",
|
|
89
|
+
)
|
|
90
|
+
end_seconds: float = pydantic.Field(
|
|
91
|
+
alias="end_seconds",
|
|
92
|
+
)
|
|
93
|
+
height: typing.Optional[int] = pydantic.Field(alias="height", default=None)
|
|
94
|
+
name: typing.Optional[str] = pydantic.Field(alias="name", default=None)
|
|
95
|
+
resolution: typing.Optional[typing_extensions.Literal["1080p", "480p", "720p"]] = (
|
|
96
|
+
pydantic.Field(alias="resolution", default=None)
|
|
97
|
+
)
|
|
98
|
+
style: typing.Optional[_SerializerV1ImageToVideoCreateBodyStyle] = pydantic.Field(
|
|
99
|
+
alias="style", default=None
|
|
100
|
+
)
|
|
101
|
+
width: typing.Optional[int] = pydantic.Field(alias="width", default=None)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import pydantic
|
|
2
|
+
import typing_extensions
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class V1ImageToVideoCreateBodyAssets(typing_extensions.TypedDict):
|
|
6
|
+
"""
|
|
7
|
+
Provide the assets for image-to-video.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
image_file_path: typing_extensions.Required[str]
|
|
11
|
+
"""
|
|
12
|
+
The path of the image file. This value is either
|
|
13
|
+
- a direct URL to the video file
|
|
14
|
+
- `file_path` field from the response of the [upload urls API](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls).
|
|
15
|
+
|
|
16
|
+
Please refer to the [Input File documentation](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls#input-file) to learn more.
|
|
17
|
+
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class _SerializerV1ImageToVideoCreateBodyAssets(pydantic.BaseModel):
|
|
22
|
+
"""
|
|
23
|
+
Serializer for V1ImageToVideoCreateBodyAssets handling case conversions
|
|
24
|
+
and file omissions as dictated by the API
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
model_config = pydantic.ConfigDict(
|
|
28
|
+
populate_by_name=True,
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
image_file_path: str = pydantic.Field(
|
|
32
|
+
alias="image_file_path",
|
|
33
|
+
)
|