magic_hour 0.33.1__py3-none-any.whl → 0.35.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/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 +6 -10
- magic_hour/resources/v1/face_swap/client.py +26 -34
- 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 -5
- magic_hour/resources/v1/image_to_video/client.py +34 -12
- magic_hour/resources/v1/lip_sync/README.md +6 -10
- magic_hour/resources/v1/lip_sync/client.py +26 -34
- 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 +11 -15
- magic_hour/resources/v1/video_to_video/client.py +30 -38
- 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 +15 -17
- 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 +18 -8
- magic_hour/types/params/v1_image_to_video_create_body_assets.py +6 -1
- magic_hour/types/params/v1_lip_sync_create_body.py +15 -17
- 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 +15 -17
- magic_hour/types/params/v1_video_to_video_create_body_assets.py +6 -1
- {magic_hour-0.33.1.dist-info → magic_hour-0.35.0.dist-info}/METADATA +1 -1
- {magic_hour-0.33.1.dist-info → magic_hour-0.35.0.dist-info}/RECORD +103 -103
- {magic_hour-0.33.1.dist-info → magic_hour-0.35.0.dist-info}/LICENSE +0 -0
- {magic_hour-0.33.1.dist-info → magic_hour-0.35.0.dist-info}/WHEEL +0 -0
|
@@ -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,11 +13,11 @@ 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` |
|
|
18
|
-
| `height` | ✗ |
|
|
19
|
-
| `name` | ✗ | The name of video | `"Face Swap video"` |
|
|
20
|
-
| `width` | ✗ |
|
|
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
|
+
| `height` | ✗ | `height` is deprecated and no longer influences the output video's resolution. Output resolution is determined by the **minimum** of: - The resolution of the input video - The maximum resolution allowed by your subscription tier. See our [pricing page](https://magichour.ai/pricing) for more details. This field is retained only for backward compatibility and will be removed in a future release. | `123` |
|
|
19
|
+
| `name` | ✗ | The name of video. This value is mainly used for your own identification of the video. | `"Face Swap video"` |
|
|
20
|
+
| `width` | ✗ | `width` is deprecated and no longer influences the output video's resolution. Output resolution is determined by the **minimum** of: - The resolution of the input video - The maximum resolution allowed by your subscription tier. See our [pricing page](https://magichour.ai/pricing) for more details. This field is retained only for backward compatibility and will be removed in a future release. | `123` |
|
|
21
21
|
|
|
22
22
|
#### Synchronous Client
|
|
23
23
|
|
|
@@ -41,9 +41,7 @@ res = client.v1.face_swap.create(
|
|
|
41
41
|
},
|
|
42
42
|
end_seconds=15.0,
|
|
43
43
|
start_seconds=0.0,
|
|
44
|
-
height=960,
|
|
45
44
|
name="Face Swap video",
|
|
46
|
-
width=512,
|
|
47
45
|
)
|
|
48
46
|
|
|
49
47
|
```
|
|
@@ -70,9 +68,7 @@ res = await client.v1.face_swap.create(
|
|
|
70
68
|
},
|
|
71
69
|
end_seconds=15.0,
|
|
72
70
|
start_seconds=0.0,
|
|
73
|
-
height=960,
|
|
74
71
|
name="Face Swap video",
|
|
75
|
-
width=512,
|
|
76
72
|
)
|
|
77
73
|
|
|
78
74
|
```
|
|
@@ -83,4 +79,4 @@ res = await client.v1.face_swap.create(
|
|
|
83
79
|
[V1FaceSwapCreateResponse](/magic_hour/types/models/v1_face_swap_create_response.py)
|
|
84
80
|
|
|
85
81
|
##### Example
|
|
86
|
-
`{"credits_charged": 450, "estimated_frame_cost": 450, "id": "
|
|
82
|
+
`{"credits_charged": 450, "estimated_frame_cost": 450, "id": "cuid-example"}`
|
|
@@ -43,26 +43,24 @@ class FaceSwapClient:
|
|
|
43
43
|
POST /v1/face-swap
|
|
44
44
|
|
|
45
45
|
Args:
|
|
46
|
-
height:
|
|
46
|
+
height: `height` is deprecated and no longer influences the output video's resolution.
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
Output resolution is determined by the **minimum** of:
|
|
49
|
+
- The resolution of the input video
|
|
50
|
+
- The maximum resolution allowed by your subscription tier. See our [pricing page](https://magichour.ai/pricing) for more details.
|
|
50
51
|
|
|
51
|
-
|
|
52
|
+
This field is retained only for backward compatibility and will be removed in a future release.
|
|
53
|
+
name: The name of video. This value is mainly used for your own identification of the video.
|
|
54
|
+
width: `width` is deprecated and no longer influences the output video's resolution.
|
|
52
55
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
+
Output resolution is determined by the **minimum** of:
|
|
57
|
+
- The resolution of the input video
|
|
58
|
+
- The maximum resolution allowed by your subscription tier. See our [pricing page](https://magichour.ai/pricing) for more details.
|
|
56
59
|
|
|
57
|
-
|
|
58
|
-
* If both height and width are omitted, the video will be resized according to your subscription's maximum resolution, while preserving aspect ratio.
|
|
59
|
-
|
|
60
|
-
Note: if the video's original resolution is less than the maximum, the video will not be resized.
|
|
61
|
-
|
|
62
|
-
See our [pricing page](https://magichour.ai/pricing) for more details.
|
|
60
|
+
This field is retained only for backward compatibility and will be removed in a future release.
|
|
63
61
|
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
|
|
62
|
+
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.
|
|
63
|
+
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
64
|
request_options: Additional options to customize the HTTP request
|
|
67
65
|
|
|
68
66
|
Returns:
|
|
@@ -89,9 +87,7 @@ class FaceSwapClient:
|
|
|
89
87
|
},
|
|
90
88
|
end_seconds=15.0,
|
|
91
89
|
start_seconds=0.0,
|
|
92
|
-
height=960,
|
|
93
90
|
name="Face Swap video",
|
|
94
|
-
width=512,
|
|
95
91
|
)
|
|
96
92
|
```
|
|
97
93
|
"""
|
|
@@ -148,26 +144,24 @@ class AsyncFaceSwapClient:
|
|
|
148
144
|
POST /v1/face-swap
|
|
149
145
|
|
|
150
146
|
Args:
|
|
151
|
-
height:
|
|
152
|
-
|
|
153
|
-
* 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.
|
|
154
|
-
* If both height and width are omitted, the video will be resized according to your subscription's maximum resolution, while preserving aspect ratio.
|
|
155
|
-
|
|
156
|
-
Note: if the video's original resolution is less than the maximum, the video will not be resized.
|
|
147
|
+
height: `height` is deprecated and no longer influences the output video's resolution.
|
|
157
148
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
149
|
+
Output resolution is determined by the **minimum** of:
|
|
150
|
+
- The resolution of the input video
|
|
151
|
+
- The maximum resolution allowed by your subscription tier. See our [pricing page](https://magichour.ai/pricing) for more details.
|
|
161
152
|
|
|
162
|
-
|
|
163
|
-
|
|
153
|
+
This field is retained only for backward compatibility and will be removed in a future release.
|
|
154
|
+
name: The name of video. This value is mainly used for your own identification of the video.
|
|
155
|
+
width: `width` is deprecated and no longer influences the output video's resolution.
|
|
164
156
|
|
|
165
|
-
|
|
157
|
+
Output resolution is determined by the **minimum** of:
|
|
158
|
+
- The resolution of the input video
|
|
159
|
+
- The maximum resolution allowed by your subscription tier. See our [pricing page](https://magichour.ai/pricing) for more details.
|
|
166
160
|
|
|
167
|
-
|
|
161
|
+
This field is retained only for backward compatibility and will be removed in a future release.
|
|
168
162
|
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
|
|
163
|
+
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.
|
|
164
|
+
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
165
|
request_options: Additional options to customize the HTTP request
|
|
172
166
|
|
|
173
167
|
Returns:
|
|
@@ -194,9 +188,7 @@ class AsyncFaceSwapClient:
|
|
|
194
188
|
},
|
|
195
189
|
end_seconds=15.0,
|
|
196
190
|
start_seconds=0.0,
|
|
197
|
-
height=960,
|
|
198
191
|
name="Face Swap video",
|
|
199
|
-
width=512,
|
|
200
192
|
)
|
|
201
193
|
```
|
|
202
194
|
"""
|
|
@@ -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(
|