magic_hour 0.40.0__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 +2 -3
- magic_hour/environment.py +1 -1
- magic_hour/helpers/download.py +2 -0
- magic_hour/resources/v1/README.md +2 -3
- magic_hour/resources/v1/ai_clothes_changer/README.md +13 -14
- magic_hour/resources/v1/ai_face_editor/README.md +26 -27
- magic_hour/resources/v1/ai_gif_generator/README.md +12 -13
- magic_hour/resources/v1/ai_gif_generator/client.py +2 -2
- magic_hour/resources/v1/ai_headshot_generator/README.md +13 -14
- magic_hour/resources/v1/ai_headshot_generator/client.py +2 -2
- magic_hour/resources/v1/ai_image_editor/README.md +24 -17
- magic_hour/resources/v1/ai_image_editor/client.py +40 -10
- magic_hour/resources/v1/ai_image_generator/README.md +26 -18
- magic_hour/resources/v1/ai_image_generator/client.py +14 -6
- magic_hour/resources/v1/ai_image_upscaler/README.md +14 -15
- magic_hour/resources/v1/ai_meme_generator/README.md +12 -13
- magic_hour/resources/v1/ai_photo_editor/README.md +22 -23
- magic_hour/resources/v1/ai_qr_code_generator/README.md +13 -14
- magic_hour/resources/v1/ai_qr_code_generator/client.py +4 -4
- magic_hour/resources/v1/ai_talking_photo/README.md +16 -17
- 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 +66 -10
- magic_hour/resources/v1/ai_voice_generator/client.py +122 -0
- magic_hour/resources/v1/animation/README.md +24 -25
- magic_hour/resources/v1/audio_projects/README.md +58 -13
- magic_hour/resources/v1/audio_projects/__init__.py +10 -2
- magic_hour/resources/v1/audio_projects/client.py +137 -0
- magic_hour/resources/v1/audio_projects/client_test.py +520 -0
- magic_hour/resources/v1/auto_subtitle_generator/README.md +15 -16
- magic_hour/resources/v1/client.py +6 -0
- magic_hour/resources/v1/face_detection/README.md +21 -20
- magic_hour/resources/v1/face_swap/README.md +23 -25
- magic_hour/resources/v1/face_swap/client.py +2 -2
- magic_hour/resources/v1/face_swap_photo/README.md +13 -14
- magic_hour/resources/v1/files/README.md +1 -5
- magic_hour/resources/v1/files/upload_urls/README.md +11 -10
- magic_hour/resources/v1/files/upload_urls/client.py +6 -4
- magic_hour/resources/v1/image_background_remover/README.md +11 -12
- magic_hour/resources/v1/image_projects/README.md +12 -16
- magic_hour/resources/v1/image_to_video/README.md +19 -21
- magic_hour/resources/v1/lip_sync/README.md +27 -21
- magic_hour/resources/v1/lip_sync/client.py +15 -0
- magic_hour/resources/v1/photo_colorizer/README.md +10 -11
- magic_hour/resources/v1/text_to_video/README.md +15 -17
- magic_hour/resources/v1/video_projects/README.md +12 -16
- magic_hour/resources/v1/video_to_video/README.md +24 -26
- magic_hour/types/models/__init__.py +2 -0
- magic_hour/types/models/v1_ai_voice_cloner_create_response.py +27 -0
- magic_hour/types/models/v1_audio_projects_get_response.py +1 -1
- magic_hour/types/models/v1_video_projects_get_response.py +1 -1
- magic_hour/types/params/__init__.py +26 -0
- magic_hour/types/params/v1_ai_image_editor_create_body_assets.py +18 -4
- magic_hour/types/params/v1_ai_image_editor_create_body_style.py +13 -0
- magic_hour/types/params/v1_ai_image_editor_generate_body_assets.py +12 -1
- magic_hour/types/params/v1_ai_image_generator_create_body_style.py +16 -0
- magic_hour/types/params/v1_ai_talking_photo_create_body_style.py +6 -4
- 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_style.py +382 -2
- magic_hour/types/params/v1_face_swap_create_body_style.py +1 -1
- magic_hour/types/params/v1_files_upload_urls_create_body_items_item.py +1 -1
- magic_hour/types/params/v1_lip_sync_create_body.py +12 -0
- magic_hour/types/params/v1_lip_sync_create_body_style.py +37 -0
- magic_hour/types/params/v1_video_to_video_create_body.py +1 -1
- magic_hour/types/params/v1_video_to_video_create_body_style.py +32 -4
- {magic_hour-0.40.0.dist-info → magic_hour-0.44.0.dist-info}/METADATA +77 -62
- {magic_hour-0.40.0.dist-info → magic_hour-0.44.0.dist-info}/RECORD +73 -63
- {magic_hour-0.40.0.dist-info → magic_hour-0.44.0.dist-info}/LICENSE +0 -0
- {magic_hour-0.40.0.dist-info → magic_hour-0.44.0.dist-info}/WHEEL +0 -0
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
## Module Functions
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
5
|
<!-- CUSTOM DOCS START -->
|
|
8
6
|
|
|
9
7
|
### Face Detection Generate Workflow <a name="generate"></a>
|
|
@@ -57,9 +55,10 @@ res = await client.v1.face_detection.generate(
|
|
|
57
55
|
```
|
|
58
56
|
|
|
59
57
|
<!-- CUSTOM DOCS END -->
|
|
58
|
+
|
|
60
59
|
### Get face detection details <a name="get"></a>
|
|
61
60
|
|
|
62
|
-
Get the details of a face detection task.
|
|
61
|
+
Get the details of a face detection task.
|
|
63
62
|
|
|
64
63
|
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.
|
|
65
64
|
|
|
@@ -67,9 +66,9 @@ Use this API to get the list of faces detected in the image or video to use in t
|
|
|
67
66
|
|
|
68
67
|
#### Parameters
|
|
69
68
|
|
|
70
|
-
| Parameter | Required | Description
|
|
71
|
-
|
|
72
|
-
| `id`
|
|
69
|
+
| Parameter | Required | Description | Example |
|
|
70
|
+
| --------- | :------: | ------------------------------------------------------------------------------------------------------------------------ | ---------------- |
|
|
71
|
+
| `id` | ✓ | The id of the task. This value is returned by the [face detection API](/api-reference/files/face-detection#response-id). | `"uuid-example"` |
|
|
73
72
|
|
|
74
73
|
#### Synchronous Client
|
|
75
74
|
|
|
@@ -79,7 +78,6 @@ from os import getenv
|
|
|
79
78
|
|
|
80
79
|
client = Client(token=getenv("API_TOKEN"))
|
|
81
80
|
res = client.v1.face_detection.get(id="uuid-example")
|
|
82
|
-
|
|
83
81
|
```
|
|
84
82
|
|
|
85
83
|
#### Asynchronous Client
|
|
@@ -90,21 +88,24 @@ from os import getenv
|
|
|
90
88
|
|
|
91
89
|
client = AsyncClient(token=getenv("API_TOKEN"))
|
|
92
90
|
res = await client.v1.face_detection.get(id="uuid-example")
|
|
93
|
-
|
|
94
91
|
```
|
|
95
92
|
|
|
96
93
|
#### Response
|
|
97
94
|
|
|
98
95
|
##### Type
|
|
96
|
+
|
|
99
97
|
[V1FaceDetectionGetResponse](/magic_hour/types/models/v1_face_detection_get_response.py)
|
|
100
98
|
|
|
101
99
|
##### Example
|
|
102
|
-
|
|
100
|
+
|
|
101
|
+
```python
|
|
102
|
+
{"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"}
|
|
103
|
+
```
|
|
103
104
|
|
|
104
105
|
### Face Detection <a name="create"></a>
|
|
105
106
|
|
|
106
|
-
Detect faces in an image or video.
|
|
107
|
-
|
|
107
|
+
Detect faces in an image or video.
|
|
108
|
+
|
|
108
109
|
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.
|
|
109
110
|
|
|
110
111
|
Note: Face detection is free to use for the near future. Pricing may change in the future.
|
|
@@ -113,11 +114,11 @@ Note: Face detection is free to use for the near future. Pricing may change in t
|
|
|
113
114
|
|
|
114
115
|
#### Parameters
|
|
115
116
|
|
|
116
|
-
| Parameter
|
|
117
|
-
|
|
118
|
-
| `assets`
|
|
119
|
-
| `└─ target_file_path` |
|
|
120
|
-
| `confidence_score`
|
|
117
|
+
| Parameter | Required | Description | Example |
|
|
118
|
+
| --------------------- | :------: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------ |
|
|
119
|
+
| `assets` | ✓ | Provide the assets for face detection | `{"target_file_path": "api-assets/id/1234.png"}` |
|
|
120
|
+
| `└─ target_file_path` | ✓ | This is the image or video where the face will be detected. This value is either - a direct URL to the video file - `file_path` field from the response of the [upload urls API](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls). Please refer to the [Input File documentation](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls#input-file) to learn more. | `"api-assets/id/1234.png"` |
|
|
121
|
+
| `confidence_score` | ✗ | Confidence threshold for filtering detected faces. * Higher values (e.g., 0.9) include only faces detected with high certainty, reducing false positives. * Lower values (e.g., 0.3) include more faces, but may increase the chance of incorrect detections. | `0.5` |
|
|
121
122
|
|
|
122
123
|
#### Synchronous Client
|
|
123
124
|
|
|
@@ -129,7 +130,6 @@ client = Client(token=getenv("API_TOKEN"))
|
|
|
129
130
|
res = client.v1.face_detection.create(
|
|
130
131
|
assets={"target_file_path": "api-assets/id/1234.png"}, confidence_score=0.5
|
|
131
132
|
)
|
|
132
|
-
|
|
133
133
|
```
|
|
134
134
|
|
|
135
135
|
#### Asynchronous Client
|
|
@@ -142,15 +142,16 @@ client = AsyncClient(token=getenv("API_TOKEN"))
|
|
|
142
142
|
res = await client.v1.face_detection.create(
|
|
143
143
|
assets={"target_file_path": "api-assets/id/1234.png"}, confidence_score=0.5
|
|
144
144
|
)
|
|
145
|
-
|
|
146
145
|
```
|
|
147
146
|
|
|
148
147
|
#### Response
|
|
149
148
|
|
|
150
149
|
##### Type
|
|
150
|
+
|
|
151
151
|
[V1FaceDetectionCreateResponse](/magic_hour/types/models/v1_face_detection_create_response.py)
|
|
152
152
|
|
|
153
153
|
##### Example
|
|
154
|
-
`{"credits_charged": 123, "id": "uuid-example"}`
|
|
155
|
-
|
|
156
154
|
|
|
155
|
+
```python
|
|
156
|
+
{"credits_charged": 123, "id": "uuid-example"}
|
|
157
|
+
```
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
## Module Functions
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
5
|
<!-- CUSTOM DOCS START -->
|
|
8
6
|
|
|
9
7
|
### Face Swap Generate Workflow <a name="generate"></a>
|
|
@@ -87,33 +85,33 @@ res = await client.v1.face_swap.generate(
|
|
|
87
85
|
```
|
|
88
86
|
|
|
89
87
|
<!-- CUSTOM DOCS END -->
|
|
90
|
-
|
|
88
|
+
|
|
89
|
+
### Face Swap Video <a name="create"></a>
|
|
91
90
|
|
|
92
91
|
Create a Face Swap video. The estimated frame cost is calculated using 30 FPS. This amount is deducted from your account balance when a video is queued. Once the video is complete, the cost will be updated based on the actual number of frames rendered.
|
|
93
|
-
|
|
92
|
+
|
|
94
93
|
Get more information about this mode at our [product page](https://magichour.ai/products/face-swap).
|
|
95
|
-
|
|
96
94
|
|
|
97
95
|
**API Endpoint**: `POST /v1/face-swap`
|
|
98
96
|
|
|
99
97
|
#### Parameters
|
|
100
98
|
|
|
101
|
-
| Parameter
|
|
102
|
-
|
|
103
|
-
| `assets`
|
|
104
|
-
| `└─ face_mappings`
|
|
105
|
-
| `└─ face_swap_mode`
|
|
106
|
-
| `└─ image_file_path` |
|
|
107
|
-
| `└─ video_file_path` |
|
|
108
|
-
| `└─ video_source`
|
|
109
|
-
| `└─ youtube_url`
|
|
110
|
-
| `end_seconds`
|
|
111
|
-
| `start_seconds`
|
|
112
|
-
| `height`
|
|
113
|
-
| `name`
|
|
114
|
-
| `style`
|
|
115
|
-
| `└─ version`
|
|
116
|
-
| `width`
|
|
99
|
+
| Parameter | Required | Deprecated | Description | Example |
|
|
100
|
+
| -------------------- | :------: | :--------: | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
101
|
+
| `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"}` |
|
|
102
|
+
| `└─ face_mappings` | ✗ | — | This is the array of face mappings used for multiple face swap. The value is required if `face_swap_mode` is `individual-faces`. | `[{"new_face": "api-assets/id/1234.png", "original_face": "api-assets/id/0-0.png"}]` |
|
|
103
|
+
| `└─ face_swap_mode` | ✗ | — | The mode of face swap. * `all-faces` - Swap all faces in the target image or video. `source_file_path` is required. * `individual-faces` - Swap individual faces in the target image or video. `source_faces` is required. | `"all-faces"` |
|
|
104
|
+
| `└─ image_file_path` | ✗ | — | 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 - a direct URL to the video file - `file_path` field from the response of the [upload urls API](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls). Please refer to the [Input File documentation](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls#input-file) to learn more. | `"image/id/1234.png"` |
|
|
105
|
+
| `└─ video_file_path` | ✗ | — | Required if `video_source` is `file`. This value is either - a direct URL to the video file - `file_path` field from the response of the [upload urls API](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls). Please refer to the [Input File documentation](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls#input-file) to learn more. | `"api-assets/id/1234.mp4"` |
|
|
106
|
+
| `└─ video_source` | ✓ | — | | `"file"` |
|
|
107
|
+
| `└─ youtube_url` | ✗ | — | Using a youtube video as the input source. This field is required if `video_source` is `youtube` | `"http://www.example.com"` |
|
|
108
|
+
| `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` |
|
|
109
|
+
| `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` |
|
|
110
|
+
| `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` |
|
|
111
|
+
| `name` | ✗ | ✗ | The name of video. This value is mainly used for your own identification of the video. | `"Face Swap video"` |
|
|
112
|
+
| `style` | ✗ | ✗ | Style of the face swap video. | `{"version": "default"}` |
|
|
113
|
+
| `└─ version` | ✗ | — | * `v1` - May preserve skin detail and texture better, but weaker identity preservation. * `v2` - Faster, sharper, better handling of hair and glasses. stronger identity preservation. * `default` - Use the version we recommend, which will change over time. This is recommended unless you need a specific earlier version. This is the default behavior. | `"default"` |
|
|
114
|
+
| `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` |
|
|
117
115
|
|
|
118
116
|
#### Synchronous Client
|
|
119
117
|
|
|
@@ -140,7 +138,6 @@ res = client.v1.face_swap.create(
|
|
|
140
138
|
name="Face Swap video",
|
|
141
139
|
style={"version": "default"},
|
|
142
140
|
)
|
|
143
|
-
|
|
144
141
|
```
|
|
145
142
|
|
|
146
143
|
#### Asynchronous Client
|
|
@@ -168,15 +165,16 @@ res = await client.v1.face_swap.create(
|
|
|
168
165
|
name="Face Swap video",
|
|
169
166
|
style={"version": "default"},
|
|
170
167
|
)
|
|
171
|
-
|
|
172
168
|
```
|
|
173
169
|
|
|
174
170
|
#### Response
|
|
175
171
|
|
|
176
172
|
##### Type
|
|
173
|
+
|
|
177
174
|
[V1FaceSwapCreateResponse](/magic_hour/types/models/v1_face_swap_create_response.py)
|
|
178
175
|
|
|
179
176
|
##### Example
|
|
180
|
-
`{"credits_charged": 450, "estimated_frame_cost": 450, "id": "cuid-example"}`
|
|
181
|
-
|
|
182
177
|
|
|
178
|
+
```python
|
|
179
|
+
{"credits_charged": 450, "estimated_frame_cost": 450, "id": "cuid-example"}
|
|
180
|
+
```
|
|
@@ -153,7 +153,7 @@ class FaceSwapClient:
|
|
|
153
153
|
request_options: typing.Optional[RequestOptions] = None,
|
|
154
154
|
) -> models.V1FaceSwapCreateResponse:
|
|
155
155
|
"""
|
|
156
|
-
Face Swap
|
|
156
|
+
Face Swap Video
|
|
157
157
|
|
|
158
158
|
Create a Face Swap video. The estimated frame cost is calculated using 30 FPS. This amount is deducted from your account balance when a video is queued. Once the video is complete, the cost will be updated based on the actual number of frames rendered.
|
|
159
159
|
|
|
@@ -372,7 +372,7 @@ class AsyncFaceSwapClient:
|
|
|
372
372
|
request_options: typing.Optional[RequestOptions] = None,
|
|
373
373
|
) -> models.V1FaceSwapCreateResponse:
|
|
374
374
|
"""
|
|
375
|
-
Face Swap
|
|
375
|
+
Face Swap Video
|
|
376
376
|
|
|
377
377
|
Create a Face Swap video. The estimated frame cost is calculated using 30 FPS. This amount is deducted from your account balance when a video is queued. Once the video is complete, the cost will be updated based on the actual number of frames rendered.
|
|
378
378
|
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
## Module Functions
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
5
|
<!-- CUSTOM DOCS START -->
|
|
8
6
|
|
|
9
7
|
### Face Swap Photo Generate Workflow <a name="generate"></a>
|
|
@@ -79,6 +77,7 @@ res = await client.v1.face_swap_photo.generate(
|
|
|
79
77
|
```
|
|
80
78
|
|
|
81
79
|
<!-- CUSTOM DOCS END -->
|
|
80
|
+
|
|
82
81
|
### Face Swap Photo <a name="create"></a>
|
|
83
82
|
|
|
84
83
|
Create a face swap photo. Each photo costs 5 credits. The height/width of the output image depends on your subscription. Please refer to our [pricing](https://magichour.ai/pricing) page for more details
|
|
@@ -87,14 +86,14 @@ Create a face swap photo. Each photo costs 5 credits. The height/width of the ou
|
|
|
87
86
|
|
|
88
87
|
#### Parameters
|
|
89
88
|
|
|
90
|
-
| Parameter
|
|
91
|
-
|
|
92
|
-
| `assets`
|
|
93
|
-
| `└─ face_mappings`
|
|
94
|
-
| `└─ face_swap_mode`
|
|
95
|
-
| `└─ source_file_path` |
|
|
96
|
-
| `└─ target_file_path` |
|
|
97
|
-
| `name`
|
|
89
|
+
| Parameter | Required | Description | Example |
|
|
90
|
+
| --------------------- | :------: | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
91
|
+
| `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"}` |
|
|
92
|
+
| `└─ face_mappings` | ✗ | This is the array of face mappings used for multiple face swap. The value is required if `face_swap_mode` is `individual-faces`. | `[{"new_face": "api-assets/id/1234.png", "original_face": "api-assets/id/0-0.png"}]` |
|
|
93
|
+
| `└─ face_swap_mode` | ✗ | The mode of face swap. * `all-faces` - Swap all faces in the target image or video. `source_file_path` is required. * `individual-faces` - Swap individual faces in the target image or video. `source_faces` is required. | `"all-faces"` |
|
|
94
|
+
| `└─ source_file_path` | ✗ | 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 - a direct URL to the video file - `file_path` field from the response of the [upload urls API](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls). Please refer to the [Input File documentation](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls#input-file) to learn more. | `"api-assets/id/1234.png"` |
|
|
95
|
+
| `└─ target_file_path` | ✓ | This is the image where the face from the source image will be placed. This value is either - a direct URL to the video file - `file_path` field from the response of the [upload urls API](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls). Please refer to the [Input File documentation](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls#input-file) to learn more. | `"api-assets/id/1234.png"` |
|
|
96
|
+
| `name` | ✗ | The name of image. This value is mainly used for your own identification of the image. | `"Face Swap image"` |
|
|
98
97
|
|
|
99
98
|
#### Synchronous Client
|
|
100
99
|
|
|
@@ -117,7 +116,6 @@ res = client.v1.face_swap_photo.create(
|
|
|
117
116
|
},
|
|
118
117
|
name="Face Swap image",
|
|
119
118
|
)
|
|
120
|
-
|
|
121
119
|
```
|
|
122
120
|
|
|
123
121
|
#### Asynchronous Client
|
|
@@ -141,15 +139,16 @@ res = await client.v1.face_swap_photo.create(
|
|
|
141
139
|
},
|
|
142
140
|
name="Face Swap image",
|
|
143
141
|
)
|
|
144
|
-
|
|
145
142
|
```
|
|
146
143
|
|
|
147
144
|
#### Response
|
|
148
145
|
|
|
149
146
|
##### Type
|
|
147
|
+
|
|
150
148
|
[V1FaceSwapPhotoCreateResponse](/magic_hour/types/models/v1_face_swap_photo_create_response.py)
|
|
151
149
|
|
|
152
150
|
##### Example
|
|
153
|
-
`{"credits_charged": 5, "frame_cost": 5, "id": "cuid-example"}`
|
|
154
|
-
|
|
155
151
|
|
|
152
|
+
```python
|
|
153
|
+
{"credits_charged": 5, "frame_cost": 5, "id": "cuid-example"}
|
|
154
|
+
```
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
# v1.files
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
3
|
<!-- CUSTOM DOCS START -->
|
|
6
4
|
|
|
7
5
|
### Upload File <a name="upload-file"></a>
|
|
@@ -34,10 +32,8 @@ client = AsyncClient(token=getenv("API_TOKEN"))
|
|
|
34
32
|
file_path = await client.v1.files.upload_file("/path/to/your/image.jpg")
|
|
35
33
|
```
|
|
36
34
|
|
|
37
|
-
|
|
38
35
|
<!-- CUSTOM DOCS END -->
|
|
39
36
|
|
|
40
|
-
|
|
41
37
|
## Submodules
|
|
42
|
-
- [upload_urls](upload_urls/README.md) - upload_urls
|
|
43
38
|
|
|
39
|
+
- [upload_urls](upload_urls/README.md) - upload_urls
|
|
@@ -9,9 +9,11 @@ Generates a list of pre-signed upload URLs for the assets required. This API is
|
|
|
9
9
|
The response array will match the order of items in the request body.
|
|
10
10
|
|
|
11
11
|
**Valid file extensions per asset type**:
|
|
12
|
+
|
|
12
13
|
- video: mp4, m4v, mov, webm
|
|
13
|
-
- audio: mp3,
|
|
14
|
-
- image: png, jpg, jpeg, webp, avif, jp2, tiff, bmp
|
|
14
|
+
- audio: mp3, wav, aac, flac, webm
|
|
15
|
+
- image: png, jpg, jpeg, heic, webp, avif, jp2, tiff, bmp
|
|
16
|
+
- gif: gif, webp, webm
|
|
15
17
|
|
|
16
18
|
> Note: `gif` is only supported for face swap API `video_file_path` field.
|
|
17
19
|
|
|
@@ -24,14 +26,13 @@ curl -X PUT --data '@/path/to/file/video.mp4' \
|
|
|
24
26
|
https://videos.magichour.ai/api-assets/id/video.mp4?<auth params from the API response>
|
|
25
27
|
```
|
|
26
28
|
|
|
27
|
-
|
|
28
29
|
**API Endpoint**: `POST /v1/files/upload-urls`
|
|
29
30
|
|
|
30
31
|
#### Parameters
|
|
31
32
|
|
|
32
|
-
| Parameter | Required | Description
|
|
33
|
-
|
|
34
|
-
| `items`
|
|
33
|
+
| Parameter | Required | Description | Example |
|
|
34
|
+
| --------- | :------: | --------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
|
|
35
|
+
| `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"}]` |
|
|
35
36
|
|
|
36
37
|
#### Synchronous Client
|
|
37
38
|
|
|
@@ -46,7 +47,6 @@ res = client.v1.files.upload_urls.create(
|
|
|
46
47
|
{"extension": "mp3", "type_": "audio"},
|
|
47
48
|
]
|
|
48
49
|
)
|
|
49
|
-
|
|
50
50
|
```
|
|
51
51
|
|
|
52
52
|
#### Asynchronous Client
|
|
@@ -62,15 +62,16 @@ res = await client.v1.files.upload_urls.create(
|
|
|
62
62
|
{"extension": "mp3", "type_": "audio"},
|
|
63
63
|
]
|
|
64
64
|
)
|
|
65
|
-
|
|
66
65
|
```
|
|
67
66
|
|
|
68
67
|
#### Response
|
|
69
68
|
|
|
70
69
|
##### Type
|
|
70
|
+
|
|
71
71
|
[V1FilesUploadUrlsCreateResponse](/magic_hour/types/models/v1_files_upload_urls_create_response.py)
|
|
72
72
|
|
|
73
73
|
##### Example
|
|
74
|
-
`{"items": [{"expires_at": "2024-07-25T16:56:21.932Z", "file_path": "api-assets/id/video.mp4", "upload_url": "https://videos.magichour.ai/api-assets/id/video.mp4?auth-value=1234567890"}, {"expires_at": "2024-07-25T16:56:21.932Z", "file_path": "api-assets/id/audio.mp3", "upload_url": "https://videos.magichour.ai/api-assets/id/audio.mp3?auth-value=1234567890"}]}`
|
|
75
|
-
|
|
76
74
|
|
|
75
|
+
```python
|
|
76
|
+
{"items": [{"expires_at": "2024-07-25T16:56:21.932Z", "file_path": "api-assets/id/video.mp4", "upload_url": "https://videos.magichour.ai/api-assets/id/video.mp4?auth-value=1234567890"}, {"expires_at": "2024-07-25T16:56:21.932Z", "file_path": "api-assets/id/audio.mp3", "upload_url": "https://videos.magichour.ai/api-assets/id/audio.mp3?auth-value=1234567890"}]}
|
|
77
|
+
```
|
|
@@ -29,8 +29,9 @@ class UploadUrlsClient:
|
|
|
29
29
|
|
|
30
30
|
**Valid file extensions per asset type**:
|
|
31
31
|
- video: mp4, m4v, mov, webm
|
|
32
|
-
- audio: mp3,
|
|
33
|
-
- image: png, jpg, jpeg, webp, avif, jp2, tiff, bmp
|
|
32
|
+
- audio: mp3, wav, aac, flac, webm
|
|
33
|
+
- image: png, jpg, jpeg, heic, webp, avif, jp2, tiff, bmp
|
|
34
|
+
- gif: gif, webp, webm
|
|
34
35
|
|
|
35
36
|
> Note: `gif` is only supported for face swap API `video_file_path` field.
|
|
36
37
|
|
|
@@ -95,8 +96,9 @@ class AsyncUploadUrlsClient:
|
|
|
95
96
|
|
|
96
97
|
**Valid file extensions per asset type**:
|
|
97
98
|
- video: mp4, m4v, mov, webm
|
|
98
|
-
- audio: mp3,
|
|
99
|
-
- image: png, jpg, jpeg, webp, avif, jp2, tiff, bmp
|
|
99
|
+
- audio: mp3, wav, aac, flac, webm
|
|
100
|
+
- image: png, jpg, jpeg, heic, webp, avif, jp2, tiff, bmp
|
|
101
|
+
- gif: gif, webp, webm
|
|
100
102
|
|
|
101
103
|
> Note: `gif` is only supported for face swap API `video_file_path` field.
|
|
102
104
|
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
## Module Functions
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
5
|
<!-- CUSTOM DOCS START -->
|
|
8
6
|
|
|
9
7
|
### Image Background Remover Generate Workflow <a name="generate"></a>
|
|
@@ -65,6 +63,7 @@ res = await client.v1.image_background_remover.generate(
|
|
|
65
63
|
```
|
|
66
64
|
|
|
67
65
|
<!-- CUSTOM DOCS END -->
|
|
66
|
+
|
|
68
67
|
### Image Background Remover <a name="create"></a>
|
|
69
68
|
|
|
70
69
|
Remove background from image. Each image costs 5 credits.
|
|
@@ -73,12 +72,12 @@ Remove background from image. Each image costs 5 credits.
|
|
|
73
72
|
|
|
74
73
|
#### Parameters
|
|
75
74
|
|
|
76
|
-
| Parameter
|
|
77
|
-
|
|
78
|
-
| `assets`
|
|
79
|
-
| `└─ background_image_file_path` |
|
|
80
|
-
| `└─ image_file_path`
|
|
81
|
-
| `name`
|
|
75
|
+
| Parameter | Required | Description | Example |
|
|
76
|
+
| ------------------------------- | :------: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
|
|
77
|
+
| `assets` | ✓ | Provide the assets for background removal | `{"background_image_file_path": "api-assets/id/1234.png", "image_file_path": "api-assets/id/1234.png"}` |
|
|
78
|
+
| `└─ background_image_file_path` | ✗ | 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 - a direct URL to the video file - `file_path` field from the response of the [upload urls API](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls). Please refer to the [Input File documentation](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls#input-file) to learn more. | `"api-assets/id/1234.png"` |
|
|
79
|
+
| `└─ image_file_path` | ✓ | The image to remove the background. This value is either - a direct URL to the video file - `file_path` field from the response of the [upload urls API](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls). Please refer to the [Input File documentation](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls#input-file) to learn more. | `"api-assets/id/1234.png"` |
|
|
80
|
+
| `name` | ✗ | The name of image. This value is mainly used for your own identification of the image. | `"Background Remover image"` |
|
|
82
81
|
|
|
83
82
|
#### Synchronous Client
|
|
84
83
|
|
|
@@ -94,7 +93,6 @@ res = client.v1.image_background_remover.create(
|
|
|
94
93
|
},
|
|
95
94
|
name="Background Remover image",
|
|
96
95
|
)
|
|
97
|
-
|
|
98
96
|
```
|
|
99
97
|
|
|
100
98
|
#### Asynchronous Client
|
|
@@ -111,15 +109,16 @@ res = await client.v1.image_background_remover.create(
|
|
|
111
109
|
},
|
|
112
110
|
name="Background Remover image",
|
|
113
111
|
)
|
|
114
|
-
|
|
115
112
|
```
|
|
116
113
|
|
|
117
114
|
#### Response
|
|
118
115
|
|
|
119
116
|
##### Type
|
|
117
|
+
|
|
120
118
|
[V1ImageBackgroundRemoverCreateResponse](/magic_hour/types/models/v1_image_background_remover_create_response.py)
|
|
121
119
|
|
|
122
120
|
##### Example
|
|
123
|
-
`{"credits_charged": 5, "frame_cost": 5, "id": "cuid-example"}`
|
|
124
|
-
|
|
125
121
|
|
|
122
|
+
```python
|
|
123
|
+
{"credits_charged": 5, "frame_cost": 5, "id": "cuid-example"}
|
|
124
|
+
```
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
## Module Functions
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
5
|
<!-- CUSTOM DOCS START -->
|
|
8
6
|
|
|
9
7
|
### Check results <a name="check-result"></a>
|
|
@@ -32,7 +30,6 @@ res = client.v1.image_projects.check_result(
|
|
|
32
30
|
download_outputs=True,
|
|
33
31
|
download_directory="outputs",
|
|
34
32
|
)
|
|
35
|
-
|
|
36
33
|
```
|
|
37
34
|
|
|
38
35
|
#### Asynchronous Client
|
|
@@ -51,6 +48,7 @@ res = await client.v1.image_projects.check_result(
|
|
|
51
48
|
```
|
|
52
49
|
|
|
53
50
|
<!-- CUSTOM DOCS END -->
|
|
51
|
+
|
|
54
52
|
### Delete image <a name="delete"></a>
|
|
55
53
|
|
|
56
54
|
Permanently delete the rendered image(s). This action is not reversible, please be sure before deleting.
|
|
@@ -59,9 +57,9 @@ Permanently delete the rendered image(s). This action is not reversible, please
|
|
|
59
57
|
|
|
60
58
|
#### Parameters
|
|
61
59
|
|
|
62
|
-
| Parameter | Required | Description
|
|
63
|
-
|
|
64
|
-
| `id`
|
|
60
|
+
| Parameter | Required | Description | Example |
|
|
61
|
+
| --------- | :------: | ---------------------------------------------------------------------------------------------------- | ---------------- |
|
|
62
|
+
| `id` | ✓ | Unique ID of the image project. This value is returned by all of the POST APIs that create an image. | `"cuid-example"` |
|
|
65
63
|
|
|
66
64
|
#### Synchronous Client
|
|
67
65
|
|
|
@@ -71,7 +69,6 @@ from os import getenv
|
|
|
71
69
|
|
|
72
70
|
client = Client(token=getenv("API_TOKEN"))
|
|
73
71
|
res = client.v1.image_projects.delete(id="cuid-example")
|
|
74
|
-
|
|
75
72
|
```
|
|
76
73
|
|
|
77
74
|
#### Asynchronous Client
|
|
@@ -82,7 +79,6 @@ from os import getenv
|
|
|
82
79
|
|
|
83
80
|
client = AsyncClient(token=getenv("API_TOKEN"))
|
|
84
81
|
res = await client.v1.image_projects.delete(id="cuid-example")
|
|
85
|
-
|
|
86
82
|
```
|
|
87
83
|
|
|
88
84
|
### Get image details <a name="get"></a>
|
|
@@ -90,6 +86,7 @@ res = await client.v1.image_projects.delete(id="cuid-example")
|
|
|
90
86
|
Get the details of a image project. The `downloads` field will be empty unless the image was successfully rendered.
|
|
91
87
|
|
|
92
88
|
The image can be one of the following status
|
|
89
|
+
|
|
93
90
|
- `draft` - not currently used
|
|
94
91
|
- `queued` - the job is queued and waiting for a GPU
|
|
95
92
|
- `rendering` - the generation is in progress
|
|
@@ -97,14 +94,13 @@ The image can be one of the following status
|
|
|
97
94
|
- `error` - an error occurred during rendering
|
|
98
95
|
- `canceled` - image render is canceled by the user
|
|
99
96
|
|
|
100
|
-
|
|
101
97
|
**API Endpoint**: `GET /v1/image-projects/{id}`
|
|
102
98
|
|
|
103
99
|
#### Parameters
|
|
104
100
|
|
|
105
|
-
| Parameter | Required | Description
|
|
106
|
-
|
|
107
|
-
| `id`
|
|
101
|
+
| Parameter | Required | Description | Example |
|
|
102
|
+
| --------- | :------: | ---------------------------------------------------------------------------------------------------- | ---------------- |
|
|
103
|
+
| `id` | ✓ | Unique ID of the image project. This value is returned by all of the POST APIs that create an image. | `"cuid-example"` |
|
|
108
104
|
|
|
109
105
|
#### Synchronous Client
|
|
110
106
|
|
|
@@ -114,7 +110,6 @@ from os import getenv
|
|
|
114
110
|
|
|
115
111
|
client = Client(token=getenv("API_TOKEN"))
|
|
116
112
|
res = client.v1.image_projects.get(id="cuid-example")
|
|
117
|
-
|
|
118
113
|
```
|
|
119
114
|
|
|
120
115
|
#### Asynchronous Client
|
|
@@ -125,15 +120,16 @@ from os import getenv
|
|
|
125
120
|
|
|
126
121
|
client = AsyncClient(token=getenv("API_TOKEN"))
|
|
127
122
|
res = await client.v1.image_projects.get(id="cuid-example")
|
|
128
|
-
|
|
129
123
|
```
|
|
130
124
|
|
|
131
125
|
#### Response
|
|
132
126
|
|
|
133
127
|
##### Type
|
|
128
|
+
|
|
134
129
|
[V1ImageProjectsGetResponse](/magic_hour/types/models/v1_image_projects_get_response.py)
|
|
135
130
|
|
|
136
131
|
##### Example
|
|
137
|
-
`{"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"}`
|
|
138
|
-
|
|
139
132
|
|
|
133
|
+
```python
|
|
134
|
+
{"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"}
|
|
135
|
+
```
|