magic_hour 0.33.0__py3-none-any.whl → 0.34.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.
Potentially problematic release.
This version of magic_hour might be problematic. Click here for more details.
- magic_hour/client.py +4 -2
- magic_hour/core/base_client.py +10 -4
- magic_hour/environment.py +1 -1
- magic_hour/resources/v1/ai_clothes_changer/README.md +5 -5
- magic_hour/resources/v1/ai_clothes_changer/client.py +4 -4
- magic_hour/resources/v1/ai_face_editor/README.md +2 -2
- magic_hour/resources/v1/ai_face_editor/client.py +2 -2
- magic_hour/resources/v1/ai_gif_generator/README.md +2 -2
- magic_hour/resources/v1/ai_gif_generator/client.py +2 -2
- magic_hour/resources/v1/ai_headshot_generator/README.md +3 -3
- magic_hour/resources/v1/ai_headshot_generator/client.py +2 -2
- magic_hour/resources/v1/ai_image_editor/README.md +2 -2
- magic_hour/resources/v1/ai_image_editor/client.py +2 -2
- magic_hour/resources/v1/ai_image_generator/README.md +5 -5
- magic_hour/resources/v1/ai_image_generator/client.py +8 -8
- magic_hour/resources/v1/ai_image_upscaler/README.md +3 -3
- magic_hour/resources/v1/ai_image_upscaler/client.py +8 -4
- magic_hour/resources/v1/ai_meme_generator/README.md +1 -1
- magic_hour/resources/v1/ai_photo_editor/README.md +2 -2
- magic_hour/resources/v1/ai_photo_editor/client.py +2 -2
- magic_hour/resources/v1/ai_qr_code_generator/README.md +2 -2
- magic_hour/resources/v1/ai_qr_code_generator/client.py +2 -2
- magic_hour/resources/v1/ai_talking_photo/README.md +2 -2
- magic_hour/resources/v1/ai_talking_photo/client.py +2 -2
- magic_hour/resources/v1/animation/README.md +8 -8
- magic_hour/resources/v1/animation/client.py +8 -8
- magic_hour/resources/v1/auto_subtitle_generator/README.md +4 -4
- magic_hour/resources/v1/auto_subtitle_generator/client.py +6 -6
- magic_hour/resources/v1/face_detection/README.md +10 -6
- magic_hour/resources/v1/face_detection/client.py +12 -4
- magic_hour/resources/v1/face_swap/README.md +4 -4
- magic_hour/resources/v1/face_swap/client.py +6 -6
- magic_hour/resources/v1/face_swap_photo/README.md +2 -2
- magic_hour/resources/v1/face_swap_photo/client.py +2 -2
- magic_hour/resources/v1/files/upload_urls/README.md +7 -6
- magic_hour/resources/v1/files/upload_urls/client.py +14 -12
- magic_hour/resources/v1/image_background_remover/README.md +2 -2
- magic_hour/resources/v1/image_background_remover/client.py +2 -2
- magic_hour/resources/v1/image_projects/README.md +8 -8
- magic_hour/resources/v1/image_projects/client.py +10 -10
- magic_hour/resources/v1/image_to_video/README.md +7 -9
- magic_hour/resources/v1/image_to_video/client.py +10 -8
- magic_hour/resources/v1/lip_sync/README.md +4 -4
- magic_hour/resources/v1/lip_sync/client.py +6 -6
- magic_hour/resources/v1/photo_colorizer/README.md +2 -2
- magic_hour/resources/v1/photo_colorizer/client.py +2 -2
- magic_hour/resources/v1/text_to_video/README.md +6 -4
- magic_hour/resources/v1/text_to_video/client.py +18 -4
- magic_hour/resources/v1/video_projects/README.md +7 -7
- magic_hour/resources/v1/video_projects/client.py +8 -8
- magic_hour/resources/v1/video_to_video/README.md +9 -9
- magic_hour/resources/v1/video_to_video/client.py +10 -10
- magic_hour/types/models/v1_face_detection_create_response.py +1 -1
- magic_hour/types/models/v1_face_detection_get_response.py +1 -1
- magic_hour/types/models/v1_files_upload_urls_create_response.py +3 -0
- magic_hour/types/models/v1_video_projects_get_response.py +2 -2
- magic_hour/types/params/v1_ai_clothes_changer_create_body.py +1 -1
- magic_hour/types/params/v1_ai_clothes_changer_create_body_assets.py +15 -2
- magic_hour/types/params/v1_ai_face_editor_create_body.py +1 -1
- magic_hour/types/params/v1_ai_face_editor_create_body_assets.py +6 -1
- magic_hour/types/params/v1_ai_face_editor_create_body_style.py +44 -47
- magic_hour/types/params/v1_ai_gif_generator_create_body.py +1 -1
- magic_hour/types/params/v1_ai_headshot_generator_create_body.py +1 -1
- magic_hour/types/params/v1_ai_headshot_generator_create_body_assets.py +6 -1
- magic_hour/types/params/v1_ai_headshot_generator_create_body_style.py +1 -1
- magic_hour/types/params/v1_ai_image_editor_create_body.py +1 -1
- magic_hour/types/params/v1_ai_image_editor_create_body_assets.py +6 -1
- magic_hour/types/params/v1_ai_image_generator_create_body.py +8 -2
- magic_hour/types/params/v1_ai_image_generator_create_body_style.py +2 -2
- magic_hour/types/params/v1_ai_image_upscaler_create_body.py +4 -2
- magic_hour/types/params/v1_ai_image_upscaler_create_body_assets.py +6 -1
- magic_hour/types/params/v1_ai_photo_editor_create_body.py +1 -1
- magic_hour/types/params/v1_ai_photo_editor_create_body_assets.py +6 -1
- magic_hour/types/params/v1_ai_qr_code_generator_create_body.py +1 -1
- magic_hour/types/params/v1_ai_talking_photo_create_body.py +1 -1
- magic_hour/types/params/v1_ai_talking_photo_create_body_assets.py +12 -2
- magic_hour/types/params/v1_animation_create_body.py +2 -2
- magic_hour/types/params/v1_animation_create_body_assets.py +12 -2
- magic_hour/types/params/v1_animation_create_body_style.py +10 -7
- magic_hour/types/params/v1_auto_subtitle_generator_create_body.py +3 -3
- magic_hour/types/params/v1_auto_subtitle_generator_create_body_assets.py +6 -1
- magic_hour/types/params/v1_face_detection_create_body_assets.py +6 -1
- magic_hour/types/params/v1_face_swap_create_body.py +3 -3
- magic_hour/types/params/v1_face_swap_create_body_assets.py +12 -2
- magic_hour/types/params/v1_face_swap_create_body_assets_face_mappings_item.py +6 -1
- magic_hour/types/params/v1_face_swap_photo_create_body.py +1 -1
- magic_hour/types/params/v1_face_swap_photo_create_body_assets.py +12 -2
- magic_hour/types/params/v1_face_swap_photo_create_body_assets_face_mappings_item.py +6 -1
- magic_hour/types/params/v1_files_upload_urls_create_body.py +3 -0
- magic_hour/types/params/v1_files_upload_urls_create_body_items_item.py +2 -2
- magic_hour/types/params/v1_image_background_remover_create_body.py +1 -1
- magic_hour/types/params/v1_image_background_remover_create_body_assets.py +12 -2
- magic_hour/types/params/v1_image_to_video_create_body.py +4 -2
- magic_hour/types/params/v1_image_to_video_create_body_assets.py +6 -1
- magic_hour/types/params/v1_lip_sync_create_body.py +3 -3
- magic_hour/types/params/v1_lip_sync_create_body_assets.py +12 -2
- magic_hour/types/params/v1_photo_colorizer_create_body.py +1 -1
- magic_hour/types/params/v1_photo_colorizer_create_body_assets.py +6 -1
- magic_hour/types/params/v1_text_to_video_create_body.py +8 -2
- magic_hour/types/params/v1_video_to_video_create_body.py +3 -3
- magic_hour/types/params/v1_video_to_video_create_body_assets.py +6 -1
- {magic_hour-0.33.0.dist-info → magic_hour-0.34.0.dist-info}/METADATA +1 -1
- {magic_hour-0.33.0.dist-info → magic_hour-0.34.0.dist-info}/RECORD +105 -105
- {magic_hour-0.33.0.dist-info → magic_hour-0.34.0.dist-info}/LICENSE +0 -0
- {magic_hour-0.33.0.dist-info → magic_hour-0.34.0.dist-info}/WHEEL +0 -0
|
@@ -35,10 +35,10 @@ class AutoSubtitleGeneratorClient:
|
|
|
35
35
|
POST /v1/auto-subtitle-generator
|
|
36
36
|
|
|
37
37
|
Args:
|
|
38
|
-
name: The name of video
|
|
38
|
+
name: The name of video. This value is mainly used for your own identification of the video.
|
|
39
39
|
assets: Provide the assets for auto subtitle generator
|
|
40
|
-
end_seconds: The end time of the input video in seconds
|
|
41
|
-
start_seconds: The start time of the input video in seconds
|
|
40
|
+
end_seconds: The end time of the input video in seconds. This value is used to trim the input video. The value must be greater than 0.1, and more than the start_seconds.
|
|
41
|
+
start_seconds: The start time of the input video in seconds. This value is used to trim the input video. The value must be greater than 0.
|
|
42
42
|
style: Style of the subtitle. At least one of `.style.template` or `.style.custom_config` must be provided.
|
|
43
43
|
* If only `.style.template` is provided, default values for the template will be used.
|
|
44
44
|
* If both are provided, the fields in `.style.custom_config` will be used to overwrite the fields in `.style.template`.
|
|
@@ -114,10 +114,10 @@ class AsyncAutoSubtitleGeneratorClient:
|
|
|
114
114
|
POST /v1/auto-subtitle-generator
|
|
115
115
|
|
|
116
116
|
Args:
|
|
117
|
-
name: The name of video
|
|
117
|
+
name: The name of video. This value is mainly used for your own identification of the video.
|
|
118
118
|
assets: Provide the assets for auto subtitle generator
|
|
119
|
-
end_seconds: The end time of the input video in seconds
|
|
120
|
-
start_seconds: The start time of the input video in seconds
|
|
119
|
+
end_seconds: The end time of the input video in seconds. This value is used to trim the input video. The value must be greater than 0.1, and more than the start_seconds.
|
|
120
|
+
start_seconds: The start time of the input video in seconds. This value is used to trim the input video. The value must be greater than 0.
|
|
121
121
|
style: Style of the subtitle. At least one of `.style.template` or `.style.custom_config` must be provided.
|
|
122
122
|
* If only `.style.template` is provided, default values for the template will be used.
|
|
123
123
|
* If both are provided, the fields in `.style.custom_config` will be used to overwrite the fields in `.style.template`.
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
|
|
2
2
|
### Get face detection details <a name="get"></a>
|
|
3
3
|
|
|
4
|
-
Get the details of a face detection task.
|
|
4
|
+
Get the details of a face detection task.
|
|
5
|
+
|
|
6
|
+
Use this API to get the list of faces detected in the image or video to use in the [face swap photo](/api-reference/face-swap-photo/face-swap-photo) or [face swap video](/api-reference/face-swap/face-swap-video) API calls for multi-face swaps.
|
|
5
7
|
|
|
6
8
|
**API Endpoint**: `GET /v1/face-detection/{id}`
|
|
7
9
|
|
|
@@ -9,7 +11,7 @@ Get the details of a face detection task.
|
|
|
9
11
|
|
|
10
12
|
| Parameter | Required | Description | Example |
|
|
11
13
|
|-----------|:--------:|-------------|--------|
|
|
12
|
-
| `id` | ✓ | The id of the task | `"
|
|
14
|
+
| `id` | ✓ | The id of the task. This value is returned by the [face detection API](/api-reference/files/face-detection#response-id). | `"uuid-example"` |
|
|
13
15
|
|
|
14
16
|
#### Synchronous Client
|
|
15
17
|
|
|
@@ -18,7 +20,7 @@ from magic_hour import Client
|
|
|
18
20
|
from os import getenv
|
|
19
21
|
|
|
20
22
|
client = Client(token=getenv("API_TOKEN"))
|
|
21
|
-
res = client.v1.face_detection.get(id="
|
|
23
|
+
res = client.v1.face_detection.get(id="uuid-example")
|
|
22
24
|
|
|
23
25
|
```
|
|
24
26
|
|
|
@@ -29,7 +31,7 @@ from magic_hour import AsyncClient
|
|
|
29
31
|
from os import getenv
|
|
30
32
|
|
|
31
33
|
client = AsyncClient(token=getenv("API_TOKEN"))
|
|
32
|
-
res = await client.v1.face_detection.get(id="
|
|
34
|
+
res = await client.v1.face_detection.get(id="uuid-example")
|
|
33
35
|
|
|
34
36
|
```
|
|
35
37
|
|
|
@@ -39,11 +41,13 @@ res = await client.v1.face_detection.get(id="string")
|
|
|
39
41
|
[V1FaceDetectionGetResponse](/magic_hour/types/models/v1_face_detection_get_response.py)
|
|
40
42
|
|
|
41
43
|
##### Example
|
|
42
|
-
`{"credits_charged":
|
|
44
|
+
`{"credits_charged": 0, "faces": [{"path": "api-assets/id/0-0.png", "url": "https://videos.magichour.ai/api-assets/id/0-0.png"}], "id": "uuid-example", "status": "complete"}`
|
|
43
45
|
|
|
44
46
|
### Face Detection <a name="create"></a>
|
|
45
47
|
|
|
46
48
|
Detect faces in an image or video.
|
|
49
|
+
|
|
50
|
+
Use this API to get the list of faces detected in the image or video to use in the [face swap photo](/api-reference/face-swap-photo/face-swap-photo) or [face swap video](/api-reference/face-swap/face-swap-video) API calls for multi-face swaps.
|
|
47
51
|
|
|
48
52
|
Note: Face detection is free to use for the near future. Pricing may change in the future.
|
|
49
53
|
|
|
@@ -88,4 +92,4 @@ res = await client.v1.face_detection.create(
|
|
|
88
92
|
[V1FaceDetectionCreateResponse](/magic_hour/types/models/v1_face_detection_create_response.py)
|
|
89
93
|
|
|
90
94
|
##### Example
|
|
91
|
-
`{"credits_charged": 123, "id": "
|
|
95
|
+
`{"credits_charged": 123, "id": "uuid-example"}`
|
|
@@ -23,10 +23,12 @@ class FaceDetectionClient:
|
|
|
23
23
|
|
|
24
24
|
Get the details of a face detection task.
|
|
25
25
|
|
|
26
|
+
Use this API to get the list of faces detected in the image or video to use in the [face swap photo](/api-reference/face-swap-photo/face-swap-photo) or [face swap video](/api-reference/face-swap/face-swap-video) API calls for multi-face swaps.
|
|
27
|
+
|
|
26
28
|
GET /v1/face-detection/{id}
|
|
27
29
|
|
|
28
30
|
Args:
|
|
29
|
-
id: The id of the task
|
|
31
|
+
id: The id of the task. This value is returned by the [face detection API](/api-reference/files/face-detection#response-id).
|
|
30
32
|
request_options: Additional options to customize the HTTP request
|
|
31
33
|
|
|
32
34
|
Returns:
|
|
@@ -38,7 +40,7 @@ class FaceDetectionClient:
|
|
|
38
40
|
|
|
39
41
|
Examples:
|
|
40
42
|
```py
|
|
41
|
-
client.v1.face_detection.get(id="
|
|
43
|
+
client.v1.face_detection.get(id="uuid-example")
|
|
42
44
|
```
|
|
43
45
|
"""
|
|
44
46
|
return self._base_client.request(
|
|
@@ -63,6 +65,8 @@ class FaceDetectionClient:
|
|
|
63
65
|
|
|
64
66
|
Detect faces in an image or video.
|
|
65
67
|
|
|
68
|
+
Use this API to get the list of faces detected in the image or video to use in the [face swap photo](/api-reference/face-swap-photo/face-swap-photo) or [face swap video](/api-reference/face-swap/face-swap-video) API calls for multi-face swaps.
|
|
69
|
+
|
|
66
70
|
Note: Face detection is free to use for the near future. Pricing may change in the future.
|
|
67
71
|
|
|
68
72
|
POST /v1/face-detection
|
|
@@ -114,10 +118,12 @@ class AsyncFaceDetectionClient:
|
|
|
114
118
|
|
|
115
119
|
Get the details of a face detection task.
|
|
116
120
|
|
|
121
|
+
Use this API to get the list of faces detected in the image or video to use in the [face swap photo](/api-reference/face-swap-photo/face-swap-photo) or [face swap video](/api-reference/face-swap/face-swap-video) API calls for multi-face swaps.
|
|
122
|
+
|
|
117
123
|
GET /v1/face-detection/{id}
|
|
118
124
|
|
|
119
125
|
Args:
|
|
120
|
-
id: The id of the task
|
|
126
|
+
id: The id of the task. This value is returned by the [face detection API](/api-reference/files/face-detection#response-id).
|
|
121
127
|
request_options: Additional options to customize the HTTP request
|
|
122
128
|
|
|
123
129
|
Returns:
|
|
@@ -129,7 +135,7 @@ class AsyncFaceDetectionClient:
|
|
|
129
135
|
|
|
130
136
|
Examples:
|
|
131
137
|
```py
|
|
132
|
-
await client.v1.face_detection.get(id="
|
|
138
|
+
await client.v1.face_detection.get(id="uuid-example")
|
|
133
139
|
```
|
|
134
140
|
"""
|
|
135
141
|
return await self._base_client.request(
|
|
@@ -154,6 +160,8 @@ class AsyncFaceDetectionClient:
|
|
|
154
160
|
|
|
155
161
|
Detect faces in an image or video.
|
|
156
162
|
|
|
163
|
+
Use this API to get the list of faces detected in the image or video to use in the [face swap photo](/api-reference/face-swap-photo/face-swap-photo) or [face swap video](/api-reference/face-swap/face-swap-video) API calls for multi-face swaps.
|
|
164
|
+
|
|
157
165
|
Note: Face detection is free to use for the near future. Pricing may change in the future.
|
|
158
166
|
|
|
159
167
|
POST /v1/face-detection
|
|
@@ -13,10 +13,10 @@ Get more information about this mode at our [product page](https://magichour.ai/
|
|
|
13
13
|
| Parameter | Required | Description | Example |
|
|
14
14
|
|-----------|:--------:|-------------|--------|
|
|
15
15
|
| `assets` | ✓ | Provide the assets for face swap. For video, The `video_source` field determines whether `video_file_path` or `youtube_url` field is used | `{"face_mappings": [{"new_face": "api-assets/id/1234.png", "original_face": "api-assets/id/0-0.png"}], "face_swap_mode": "all-faces", "image_file_path": "image/id/1234.png", "video_file_path": "api-assets/id/1234.mp4", "video_source": "file"}` |
|
|
16
|
-
| `end_seconds` | ✓ | The end time of the input video in seconds | `15.0` |
|
|
17
|
-
| `start_seconds` | ✓ | The start time of the input video in seconds | `0.0` |
|
|
16
|
+
| `end_seconds` | ✓ | The end time of the input video in seconds. This value is used to trim the input video. The value must be greater than 0.1, and more than the start_seconds. | `15.0` |
|
|
17
|
+
| `start_seconds` | ✓ | The start time of the input video in seconds. This value is used to trim the input video. The value must be greater than 0. | `0.0` |
|
|
18
18
|
| `height` | ✗ | Used to determine the dimensions of the output video. * If height is provided, width will also be required. The larger value between width and height will be used to determine the maximum output resolution while maintaining the original aspect ratio. * If both height and width are omitted, the video will be resized according to your subscription's maximum resolution, while preserving aspect ratio. Note: if the video's original resolution is less than the maximum, the video will not be resized. See our [pricing page](https://magichour.ai/pricing) for more details. | `960` |
|
|
19
|
-
| `name` | ✗ | The name of video | `"Face Swap video"` |
|
|
19
|
+
| `name` | ✗ | The name of video. This value is mainly used for your own identification of the video. | `"Face Swap video"` |
|
|
20
20
|
| `width` | ✗ | Used to determine the dimensions of the output video. * If width is provided, height will also be required. The larger value between width and height will be used to determine the maximum output resolution while maintaining the original aspect ratio. * If both height and width are omitted, the video will be resized according to your subscription's maximum resolution, while preserving aspect ratio. Note: if the video's original resolution is less than the maximum, the video will not be resized. See our [pricing page](https://magichour.ai/pricing) for more details. | `512` |
|
|
21
21
|
|
|
22
22
|
#### Synchronous Client
|
|
@@ -83,4 +83,4 @@ res = await client.v1.face_swap.create(
|
|
|
83
83
|
[V1FaceSwapCreateResponse](/magic_hour/types/models/v1_face_swap_create_response.py)
|
|
84
84
|
|
|
85
85
|
##### Example
|
|
86
|
-
`{"credits_charged": 450, "estimated_frame_cost": 450, "id": "
|
|
86
|
+
`{"credits_charged": 450, "estimated_frame_cost": 450, "id": "cuid-example"}`
|
|
@@ -51,7 +51,7 @@ class FaceSwapClient:
|
|
|
51
51
|
Note: if the video's original resolution is less than the maximum, the video will not be resized.
|
|
52
52
|
|
|
53
53
|
See our [pricing page](https://magichour.ai/pricing) for more details.
|
|
54
|
-
name: The name of video
|
|
54
|
+
name: The name of video. This value is mainly used for your own identification of the video.
|
|
55
55
|
width: Used to determine the dimensions of the output video.
|
|
56
56
|
|
|
57
57
|
* If width is provided, height will also be required. The larger value between width and height will be used to determine the maximum output resolution while maintaining the original aspect ratio.
|
|
@@ -61,8 +61,8 @@ class FaceSwapClient:
|
|
|
61
61
|
|
|
62
62
|
See our [pricing page](https://magichour.ai/pricing) for more details.
|
|
63
63
|
assets: Provide the assets for face swap. For video, The `video_source` field determines whether `video_file_path` or `youtube_url` field is used
|
|
64
|
-
end_seconds: The end time of the input video in seconds
|
|
65
|
-
start_seconds: The start time of the input video in seconds
|
|
64
|
+
end_seconds: The end time of the input video in seconds. This value is used to trim the input video. The value must be greater than 0.1, and more than the start_seconds.
|
|
65
|
+
start_seconds: The start time of the input video in seconds. This value is used to trim the input video. The value must be greater than 0.
|
|
66
66
|
request_options: Additional options to customize the HTTP request
|
|
67
67
|
|
|
68
68
|
Returns:
|
|
@@ -156,7 +156,7 @@ class AsyncFaceSwapClient:
|
|
|
156
156
|
Note: if the video's original resolution is less than the maximum, the video will not be resized.
|
|
157
157
|
|
|
158
158
|
See our [pricing page](https://magichour.ai/pricing) for more details.
|
|
159
|
-
name: The name of video
|
|
159
|
+
name: The name of video. This value is mainly used for your own identification of the video.
|
|
160
160
|
width: Used to determine the dimensions of the output video.
|
|
161
161
|
|
|
162
162
|
* If width is provided, height will also be required. The larger value between width and height will be used to determine the maximum output resolution while maintaining the original aspect ratio.
|
|
@@ -166,8 +166,8 @@ class AsyncFaceSwapClient:
|
|
|
166
166
|
|
|
167
167
|
See our [pricing page](https://magichour.ai/pricing) for more details.
|
|
168
168
|
assets: Provide the assets for face swap. For video, The `video_source` field determines whether `video_file_path` or `youtube_url` field is used
|
|
169
|
-
end_seconds: The end time of the input video in seconds
|
|
170
|
-
start_seconds: The start time of the input video in seconds
|
|
169
|
+
end_seconds: The end time of the input video in seconds. This value is used to trim the input video. The value must be greater than 0.1, and more than the start_seconds.
|
|
170
|
+
start_seconds: The start time of the input video in seconds. This value is used to trim the input video. The value must be greater than 0.
|
|
171
171
|
request_options: Additional options to customize the HTTP request
|
|
172
172
|
|
|
173
173
|
Returns:
|
|
@@ -10,7 +10,7 @@ Create a face swap photo. Each photo costs 5 credits. The height/width of the ou
|
|
|
10
10
|
| Parameter | Required | Description | Example |
|
|
11
11
|
|-----------|:--------:|-------------|--------|
|
|
12
12
|
| `assets` | ✓ | Provide the assets for face swap photo | `{"face_mappings": [{"new_face": "api-assets/id/1234.png", "original_face": "api-assets/id/0-0.png"}], "face_swap_mode": "all-faces", "source_file_path": "api-assets/id/1234.png", "target_file_path": "api-assets/id/1234.png"}` |
|
|
13
|
-
| `name` | ✗ | The name of image | `"Face Swap image"` |
|
|
13
|
+
| `name` | ✗ | The name of image. This value is mainly used for your own identification of the image. | `"Face Swap image"` |
|
|
14
14
|
|
|
15
15
|
#### Synchronous Client
|
|
16
16
|
|
|
@@ -66,4 +66,4 @@ res = await client.v1.face_swap_photo.create(
|
|
|
66
66
|
[V1FaceSwapPhotoCreateResponse](/magic_hour/types/models/v1_face_swap_photo_create_response.py)
|
|
67
67
|
|
|
68
68
|
##### Example
|
|
69
|
-
`{"credits_charged": 5, "frame_cost": 5, "id": "
|
|
69
|
+
`{"credits_charged": 5, "frame_cost": 5, "id": "cuid-example"}`
|
|
@@ -32,7 +32,7 @@ class FaceSwapPhotoClient:
|
|
|
32
32
|
POST /v1/face-swap-photo
|
|
33
33
|
|
|
34
34
|
Args:
|
|
35
|
-
name: The name of image
|
|
35
|
+
name: The name of image. This value is mainly used for your own identification of the image.
|
|
36
36
|
assets: Provide the assets for face swap photo
|
|
37
37
|
request_options: Additional options to customize the HTTP request
|
|
38
38
|
|
|
@@ -96,7 +96,7 @@ class AsyncFaceSwapPhotoClient:
|
|
|
96
96
|
POST /v1/face-swap-photo
|
|
97
97
|
|
|
98
98
|
Args:
|
|
99
|
-
name: The name of image
|
|
99
|
+
name: The name of image. This value is mainly used for your own identification of the image.
|
|
100
100
|
assets: Provide the assets for face swap photo
|
|
101
101
|
request_options: Additional options to customize the HTTP request
|
|
102
102
|
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
|
|
2
2
|
### Generate asset upload urls <a name="create"></a>
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
Generates a list of pre-signed upload URLs for the assets required. This API is only necessary if you want to upload to Magic Hour's storage. Refer to the [Input Files Guide](/integration/input-files) for more details.
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
The response array will match the order of items in the request body.
|
|
7
7
|
|
|
8
|
+
**Valid file extensions per asset type**:
|
|
8
9
|
- video: mp4, m4v, mov, webm
|
|
9
10
|
- audio: mp3, mpeg, wav, aac, aiff, flac
|
|
10
11
|
- image: png, jpg, jpeg, webp, avif, jp2, tiff, bmp
|
|
11
12
|
|
|
12
|
-
Note:
|
|
13
|
+
> Note: `gif` is only supported for face swap API `video_file_path` field.
|
|
13
14
|
|
|
14
|
-
|
|
15
|
+
Once you receive an upload URL, send a `PUT` request to upload the file directly.
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
Example:
|
|
17
18
|
|
|
18
19
|
```
|
|
19
20
|
curl -X PUT --data '@/path/to/file/video.mp4' \
|
|
@@ -27,7 +28,7 @@ curl -X PUT --data '@/path/to/file/video.mp4' \
|
|
|
27
28
|
|
|
28
29
|
| Parameter | Required | Description | Example |
|
|
29
30
|
|-----------|:--------:|-------------|--------|
|
|
30
|
-
| `items` | ✓ |
|
|
31
|
+
| `items` | ✓ | The list of assets to upload. The response array will match the order of items in the request body. | `[{"extension": "mp4", "type_": "video"}, {"extension": "mp3", "type_": "audio"}]` |
|
|
31
32
|
|
|
32
33
|
#### Synchronous Client
|
|
33
34
|
|
|
@@ -23,19 +23,20 @@ class UploadUrlsClient:
|
|
|
23
23
|
"""
|
|
24
24
|
Generate asset upload urls
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
Generates a list of pre-signed upload URLs for the assets required. This API is only necessary if you want to upload to Magic Hour's storage. Refer to the [Input Files Guide](/integration/input-files) for more details.
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
The response array will match the order of items in the request body.
|
|
29
29
|
|
|
30
|
+
**Valid file extensions per asset type**:
|
|
30
31
|
- video: mp4, m4v, mov, webm
|
|
31
32
|
- audio: mp3, mpeg, wav, aac, aiff, flac
|
|
32
33
|
- image: png, jpg, jpeg, webp, avif, jp2, tiff, bmp
|
|
33
34
|
|
|
34
|
-
Note:
|
|
35
|
+
> Note: `gif` is only supported for face swap API `video_file_path` field.
|
|
35
36
|
|
|
36
|
-
|
|
37
|
+
Once you receive an upload URL, send a `PUT` request to upload the file directly.
|
|
37
38
|
|
|
38
|
-
|
|
39
|
+
Example:
|
|
39
40
|
|
|
40
41
|
```
|
|
41
42
|
curl -X PUT --data '@/path/to/file/video.mp4' \
|
|
@@ -46,7 +47,7 @@ class UploadUrlsClient:
|
|
|
46
47
|
POST /v1/files/upload-urls
|
|
47
48
|
|
|
48
49
|
Args:
|
|
49
|
-
items:
|
|
50
|
+
items: The list of assets to upload. The response array will match the order of items in the request body.
|
|
50
51
|
request_options: Additional options to customize the HTTP request
|
|
51
52
|
|
|
52
53
|
Returns:
|
|
@@ -88,19 +89,20 @@ class AsyncUploadUrlsClient:
|
|
|
88
89
|
"""
|
|
89
90
|
Generate asset upload urls
|
|
90
91
|
|
|
91
|
-
|
|
92
|
+
Generates a list of pre-signed upload URLs for the assets required. This API is only necessary if you want to upload to Magic Hour's storage. Refer to the [Input Files Guide](/integration/input-files) for more details.
|
|
92
93
|
|
|
93
|
-
|
|
94
|
+
The response array will match the order of items in the request body.
|
|
94
95
|
|
|
96
|
+
**Valid file extensions per asset type**:
|
|
95
97
|
- video: mp4, m4v, mov, webm
|
|
96
98
|
- audio: mp3, mpeg, wav, aac, aiff, flac
|
|
97
99
|
- image: png, jpg, jpeg, webp, avif, jp2, tiff, bmp
|
|
98
100
|
|
|
99
|
-
Note:
|
|
101
|
+
> Note: `gif` is only supported for face swap API `video_file_path` field.
|
|
100
102
|
|
|
101
|
-
|
|
103
|
+
Once you receive an upload URL, send a `PUT` request to upload the file directly.
|
|
102
104
|
|
|
103
|
-
|
|
105
|
+
Example:
|
|
104
106
|
|
|
105
107
|
```
|
|
106
108
|
curl -X PUT --data '@/path/to/file/video.mp4' \
|
|
@@ -111,7 +113,7 @@ class AsyncUploadUrlsClient:
|
|
|
111
113
|
POST /v1/files/upload-urls
|
|
112
114
|
|
|
113
115
|
Args:
|
|
114
|
-
items:
|
|
116
|
+
items: The list of assets to upload. The response array will match the order of items in the request body.
|
|
115
117
|
request_options: Additional options to customize the HTTP request
|
|
116
118
|
|
|
117
119
|
Returns:
|
|
@@ -10,7 +10,7 @@ Remove background from image. Each image costs 5 credits.
|
|
|
10
10
|
| Parameter | Required | Description | Example |
|
|
11
11
|
|-----------|:--------:|-------------|--------|
|
|
12
12
|
| `assets` | ✓ | Provide the assets for background removal | `{"background_image_file_path": "api-assets/id/1234.png", "image_file_path": "api-assets/id/1234.png"}` |
|
|
13
|
-
| `name` | ✗ | The name of image | `"Background Remover image"` |
|
|
13
|
+
| `name` | ✗ | The name of image. This value is mainly used for your own identification of the image. | `"Background Remover image"` |
|
|
14
14
|
|
|
15
15
|
#### Synchronous Client
|
|
16
16
|
|
|
@@ -52,4 +52,4 @@ res = await client.v1.image_background_remover.create(
|
|
|
52
52
|
[V1ImageBackgroundRemoverCreateResponse](/magic_hour/types/models/v1_image_background_remover_create_response.py)
|
|
53
53
|
|
|
54
54
|
##### Example
|
|
55
|
-
`{"credits_charged": 5, "frame_cost": 5, "id": "
|
|
55
|
+
`{"credits_charged": 5, "frame_cost": 5, "id": "cuid-example"}`
|
|
@@ -32,7 +32,7 @@ class ImageBackgroundRemoverClient:
|
|
|
32
32
|
POST /v1/image-background-remover
|
|
33
33
|
|
|
34
34
|
Args:
|
|
35
|
-
name: The name of image
|
|
35
|
+
name: The name of image. This value is mainly used for your own identification of the image.
|
|
36
36
|
assets: Provide the assets for background removal
|
|
37
37
|
request_options: Additional options to customize the HTTP request
|
|
38
38
|
|
|
@@ -89,7 +89,7 @@ class AsyncImageBackgroundRemoverClient:
|
|
|
89
89
|
POST /v1/image-background-remover
|
|
90
90
|
|
|
91
91
|
Args:
|
|
92
|
-
name: The name of image
|
|
92
|
+
name: The name of image. This value is mainly used for your own identification of the image.
|
|
93
93
|
assets: Provide the assets for background removal
|
|
94
94
|
request_options: Additional options to customize the HTTP request
|
|
95
95
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
### Delete image <a name="delete"></a>
|
|
3
3
|
|
|
4
|
-
Permanently delete the rendered image. This action is not reversible, please be sure before deleting.
|
|
4
|
+
Permanently delete the rendered image(s). This action is not reversible, please be sure before deleting.
|
|
5
5
|
|
|
6
6
|
**API Endpoint**: `DELETE /v1/image-projects/{id}`
|
|
7
7
|
|
|
@@ -9,7 +9,7 @@ Permanently delete the rendered image. This action is not reversible, please be
|
|
|
9
9
|
|
|
10
10
|
| Parameter | Required | Description | Example |
|
|
11
11
|
|-----------|:--------:|-------------|--------|
|
|
12
|
-
| `id` | ✓ |
|
|
12
|
+
| `id` | ✓ | Unique ID of the image project. This value is returned by all of the POST APIs that create an image. | `"cuid-example"` |
|
|
13
13
|
|
|
14
14
|
#### Synchronous Client
|
|
15
15
|
|
|
@@ -18,7 +18,7 @@ from magic_hour import Client
|
|
|
18
18
|
from os import getenv
|
|
19
19
|
|
|
20
20
|
client = Client(token=getenv("API_TOKEN"))
|
|
21
|
-
res = client.v1.image_projects.delete(id="
|
|
21
|
+
res = client.v1.image_projects.delete(id="cuid-example")
|
|
22
22
|
|
|
23
23
|
```
|
|
24
24
|
|
|
@@ -29,7 +29,7 @@ from magic_hour import AsyncClient
|
|
|
29
29
|
from os import getenv
|
|
30
30
|
|
|
31
31
|
client = AsyncClient(token=getenv("API_TOKEN"))
|
|
32
|
-
res = await client.v1.image_projects.delete(id="
|
|
32
|
+
res = await client.v1.image_projects.delete(id="cuid-example")
|
|
33
33
|
|
|
34
34
|
```
|
|
35
35
|
|
|
@@ -52,7 +52,7 @@ The image can be one of the following status
|
|
|
52
52
|
|
|
53
53
|
| Parameter | Required | Description | Example |
|
|
54
54
|
|-----------|:--------:|-------------|--------|
|
|
55
|
-
| `id` | ✓ |
|
|
55
|
+
| `id` | ✓ | Unique ID of the image project. This value is returned by all of the POST APIs that create an image. | `"cuid-example"` |
|
|
56
56
|
|
|
57
57
|
#### Synchronous Client
|
|
58
58
|
|
|
@@ -61,7 +61,7 @@ from magic_hour import Client
|
|
|
61
61
|
from os import getenv
|
|
62
62
|
|
|
63
63
|
client = Client(token=getenv("API_TOKEN"))
|
|
64
|
-
res = client.v1.image_projects.get(id="
|
|
64
|
+
res = client.v1.image_projects.get(id="cuid-example")
|
|
65
65
|
|
|
66
66
|
```
|
|
67
67
|
|
|
@@ -72,7 +72,7 @@ from magic_hour import AsyncClient
|
|
|
72
72
|
from os import getenv
|
|
73
73
|
|
|
74
74
|
client = AsyncClient(token=getenv("API_TOKEN"))
|
|
75
|
-
res = await client.v1.image_projects.get(id="
|
|
75
|
+
res = await client.v1.image_projects.get(id="cuid-example")
|
|
76
76
|
|
|
77
77
|
```
|
|
78
78
|
|
|
@@ -82,4 +82,4 @@ res = await client.v1.image_projects.get(id="cm6pvghix03bvyz0zwash6noj")
|
|
|
82
82
|
[V1ImageProjectsGetResponse](/magic_hour/types/models/v1_image_projects_get_response.py)
|
|
83
83
|
|
|
84
84
|
##### Example
|
|
85
|
-
`{"created_at": "1970-01-01T00:00:00", "credits_charged": 5, "downloads": [{"expires_at": "2024-10-19T05:16:19.027Z", "url": "https://videos.magichour.ai/id/output.png"}], "enabled": True, "error": {"code": "no_source_face", "message": "Please use an image with a detectable face"}, "id": "
|
|
85
|
+
`{"created_at": "1970-01-01T00:00:00", "credits_charged": 5, "downloads": [{"expires_at": "2024-10-19T05:16:19.027Z", "url": "https://videos.magichour.ai/id/output.png"}], "enabled": True, "error": {"code": "no_source_face", "message": "Please use an image with a detectable face"}, "id": "cuid-example", "image_count": 1, "name": "Example Name", "status": "complete", "total_frame_cost": 5, "type_": "AI_IMAGE"}`
|
|
@@ -19,12 +19,12 @@ class ImageProjectsClient:
|
|
|
19
19
|
"""
|
|
20
20
|
Delete image
|
|
21
21
|
|
|
22
|
-
Permanently delete the rendered image. This action is not reversible, please be sure before deleting.
|
|
22
|
+
Permanently delete the rendered image(s). This action is not reversible, please be sure before deleting.
|
|
23
23
|
|
|
24
24
|
DELETE /v1/image-projects/{id}
|
|
25
25
|
|
|
26
26
|
Args:
|
|
27
|
-
id:
|
|
27
|
+
id: Unique ID of the image project. This value is returned by all of the POST APIs that create an image.
|
|
28
28
|
request_options: Additional options to customize the HTTP request
|
|
29
29
|
|
|
30
30
|
Returns:
|
|
@@ -36,7 +36,7 @@ class ImageProjectsClient:
|
|
|
36
36
|
|
|
37
37
|
Examples:
|
|
38
38
|
```py
|
|
39
|
-
client.v1.image_projects.delete(id="
|
|
39
|
+
client.v1.image_projects.delete(id="cuid-example")
|
|
40
40
|
```
|
|
41
41
|
"""
|
|
42
42
|
self._base_client.request(
|
|
@@ -67,7 +67,7 @@ class ImageProjectsClient:
|
|
|
67
67
|
GET /v1/image-projects/{id}
|
|
68
68
|
|
|
69
69
|
Args:
|
|
70
|
-
id:
|
|
70
|
+
id: Unique ID of the image project. This value is returned by all of the POST APIs that create an image.
|
|
71
71
|
request_options: Additional options to customize the HTTP request
|
|
72
72
|
|
|
73
73
|
Returns:
|
|
@@ -79,7 +79,7 @@ class ImageProjectsClient:
|
|
|
79
79
|
|
|
80
80
|
Examples:
|
|
81
81
|
```py
|
|
82
|
-
client.v1.image_projects.get(id="
|
|
82
|
+
client.v1.image_projects.get(id="cuid-example")
|
|
83
83
|
```
|
|
84
84
|
"""
|
|
85
85
|
return self._base_client.request(
|
|
@@ -101,12 +101,12 @@ class AsyncImageProjectsClient:
|
|
|
101
101
|
"""
|
|
102
102
|
Delete image
|
|
103
103
|
|
|
104
|
-
Permanently delete the rendered image. This action is not reversible, please be sure before deleting.
|
|
104
|
+
Permanently delete the rendered image(s). This action is not reversible, please be sure before deleting.
|
|
105
105
|
|
|
106
106
|
DELETE /v1/image-projects/{id}
|
|
107
107
|
|
|
108
108
|
Args:
|
|
109
|
-
id:
|
|
109
|
+
id: Unique ID of the image project. This value is returned by all of the POST APIs that create an image.
|
|
110
110
|
request_options: Additional options to customize the HTTP request
|
|
111
111
|
|
|
112
112
|
Returns:
|
|
@@ -118,7 +118,7 @@ class AsyncImageProjectsClient:
|
|
|
118
118
|
|
|
119
119
|
Examples:
|
|
120
120
|
```py
|
|
121
|
-
await client.v1.image_projects.delete(id="
|
|
121
|
+
await client.v1.image_projects.delete(id="cuid-example")
|
|
122
122
|
```
|
|
123
123
|
"""
|
|
124
124
|
await self._base_client.request(
|
|
@@ -149,7 +149,7 @@ class AsyncImageProjectsClient:
|
|
|
149
149
|
GET /v1/image-projects/{id}
|
|
150
150
|
|
|
151
151
|
Args:
|
|
152
|
-
id:
|
|
152
|
+
id: Unique ID of the image project. This value is returned by all of the POST APIs that create an image.
|
|
153
153
|
request_options: Additional options to customize the HTTP request
|
|
154
154
|
|
|
155
155
|
Returns:
|
|
@@ -161,7 +161,7 @@ class AsyncImageProjectsClient:
|
|
|
161
161
|
|
|
162
162
|
Examples:
|
|
163
163
|
```py
|
|
164
|
-
await client.v1.image_projects.get(id="
|
|
164
|
+
await client.v1.image_projects.get(id="cuid-example")
|
|
165
165
|
```
|
|
166
166
|
"""
|
|
167
167
|
return await self._base_client.request(
|
|
@@ -14,11 +14,11 @@ Get more information about this mode at our [product page](https://magichour.ai/
|
|
|
14
14
|
|-----------|:--------:|-------------|--------|
|
|
15
15
|
| `assets` | ✓ | Provide the assets for image-to-video. | `{"image_file_path": "api-assets/id/1234.png"}` |
|
|
16
16
|
| `end_seconds` | ✓ | The total duration of the output video in seconds. | `5.0` |
|
|
17
|
-
| `height` | ✗ | This field does not affect the output video's resolution. The video's orientation will match that of the input image. It is retained solely for backward compatibility and will be deprecated in the future. | `
|
|
18
|
-
| `name` | ✗ | The name of video | `"Image To Video video"` |
|
|
19
|
-
| `resolution` | ✗ | Controls the output video resolution. Defaults to `720p` if not specified. **Options:** - `480p` - Supports only 5 or 10 second videos. Output: 24fps. Cost: 120 credits per 5 seconds. - `720p` - Supports videos between 5-60 seconds. Output: 30fps. Cost: 300 credits per 5 seconds. - `1080p` - Supports videos between 5-60 seconds. Output: 30fps. Cost: 600 credits per 5 seconds.
|
|
17
|
+
| `height` | ✗ | This field does not affect the output video's resolution. The video's orientation will match that of the input image. It is retained solely for backward compatibility and will be deprecated in the future. | `123` |
|
|
18
|
+
| `name` | ✗ | The name of video. This value is mainly used for your own identification of the video. | `"Image To Video video"` |
|
|
19
|
+
| `resolution` | ✗ | Controls the output video resolution. Defaults to `720p` if not specified. 480p and 720p are available on Creator, Pro, or Business tiers. However, 1080p require Pro or Business tier. **Options:** - `480p` - Supports only 5 or 10 second videos. Output: 24fps. Cost: 120 credits per 5 seconds. - `720p` - Supports videos between 5-60 seconds. Output: 30fps. Cost: 300 credits per 5 seconds. - `1080p` - Supports videos between 5-60 seconds. Output: 30fps. Cost: 600 credits per 5 seconds. | `"720p"` |
|
|
20
20
|
| `style` | ✗ | Attributed used to dictate the style of the output | `{"prompt": "a dog running"}` |
|
|
21
|
-
| `width` | ✗ | This field does not affect the output video's resolution. The video's orientation will match that of the input image. It is retained solely for backward compatibility and will be deprecated in the future. | `
|
|
21
|
+
| `width` | ✗ | This field does not affect the output video's resolution. The video's orientation will match that of the input image. It is retained solely for backward compatibility and will be deprecated in the future. | `123` |
|
|
22
22
|
|
|
23
23
|
#### Synchronous Client
|
|
24
24
|
|
|
@@ -30,9 +30,8 @@ client = Client(token=getenv("API_TOKEN"))
|
|
|
30
30
|
res = client.v1.image_to_video.create(
|
|
31
31
|
assets={"image_file_path": "api-assets/id/1234.png"},
|
|
32
32
|
end_seconds=5.0,
|
|
33
|
-
height=960,
|
|
34
33
|
name="Image To Video video",
|
|
35
|
-
|
|
34
|
+
resolution="720p",
|
|
36
35
|
)
|
|
37
36
|
|
|
38
37
|
```
|
|
@@ -47,9 +46,8 @@ client = AsyncClient(token=getenv("API_TOKEN"))
|
|
|
47
46
|
res = await client.v1.image_to_video.create(
|
|
48
47
|
assets={"image_file_path": "api-assets/id/1234.png"},
|
|
49
48
|
end_seconds=5.0,
|
|
50
|
-
height=960,
|
|
51
49
|
name="Image To Video video",
|
|
52
|
-
|
|
50
|
+
resolution="720p",
|
|
53
51
|
)
|
|
54
52
|
|
|
55
53
|
```
|
|
@@ -60,4 +58,4 @@ res = await client.v1.image_to_video.create(
|
|
|
60
58
|
[V1ImageToVideoCreateResponse](/magic_hour/types/models/v1_image_to_video_create_response.py)
|
|
61
59
|
|
|
62
60
|
##### Example
|
|
63
|
-
`{"credits_charged": 450, "estimated_frame_cost": 450, "id": "
|
|
61
|
+
`{"credits_charged": 450, "estimated_frame_cost": 450, "id": "cuid-example"}`
|