magic_hour 0.39.0__py3-none-any.whl → 0.40.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 -0
- magic_hour/environment.py +1 -1
- magic_hour/resources/v1/README.md +2 -0
- magic_hour/resources/v1/ai_clothes_changer/README.md +1 -0
- magic_hour/resources/v1/ai_face_editor/README.md +1 -0
- magic_hour/resources/v1/ai_gif_generator/README.md +1 -0
- magic_hour/resources/v1/ai_headshot_generator/README.md +1 -0
- magic_hour/resources/v1/ai_image_editor/README.md +1 -0
- magic_hour/resources/v1/ai_image_generator/README.md +1 -0
- magic_hour/resources/v1/ai_image_upscaler/README.md +1 -0
- magic_hour/resources/v1/ai_meme_generator/README.md +1 -0
- magic_hour/resources/v1/ai_photo_editor/README.md +1 -0
- magic_hour/resources/v1/ai_qr_code_generator/README.md +1 -0
- magic_hour/resources/v1/ai_talking_photo/README.md +1 -0
- magic_hour/resources/v1/ai_voice_generator/README.md +56 -0
- magic_hour/resources/v1/ai_voice_generator/__init__.py +4 -0
- magic_hour/resources/v1/ai_voice_generator/client.py +119 -0
- magic_hour/resources/v1/animation/README.md +1 -0
- magic_hour/resources/v1/audio_projects/README.md +90 -0
- magic_hour/resources/v1/audio_projects/__init__.py +4 -0
- magic_hour/resources/v1/audio_projects/client.py +173 -0
- magic_hour/resources/v1/auto_subtitle_generator/README.md +1 -0
- magic_hour/resources/v1/client.py +14 -0
- magic_hour/resources/v1/face_detection/README.md +1 -0
- magic_hour/resources/v1/face_swap/README.md +1 -0
- magic_hour/resources/v1/face_swap_photo/README.md +1 -0
- magic_hour/resources/v1/files/README.md +1 -0
- magic_hour/resources/v1/image_background_remover/README.md +1 -0
- magic_hour/resources/v1/image_projects/README.md +1 -0
- magic_hour/resources/v1/image_to_video/README.md +1 -0
- magic_hour/resources/v1/lip_sync/README.md +1 -0
- magic_hour/resources/v1/photo_colorizer/README.md +1 -0
- magic_hour/resources/v1/text_to_video/README.md +1 -0
- magic_hour/resources/v1/video_projects/README.md +1 -0
- magic_hour/resources/v1/video_to_video/README.md +6 -7
- magic_hour/resources/v1/video_to_video/client.py +0 -2
- magic_hour/types/models/__init__.py +10 -0
- magic_hour/types/models/v1_ai_voice_generator_create_response.py +27 -0
- magic_hour/types/models/v1_audio_projects_get_response.py +72 -0
- magic_hour/types/models/v1_audio_projects_get_response_downloads_item.py +19 -0
- magic_hour/types/models/v1_audio_projects_get_response_error.py +25 -0
- magic_hour/types/params/__init__.py +12 -0
- magic_hour/types/params/v1_ai_voice_generator_create_body.py +40 -0
- magic_hour/types/params/v1_ai_voice_generator_create_body_style.py +60 -0
- magic_hour/types/params/v1_video_to_video_create_body_style.py +19 -19
- {magic_hour-0.39.0.dist-info → magic_hour-0.40.0.dist-info}/METADATA +11 -1
- {magic_hour-0.39.0.dist-info → magic_hour-0.40.0.dist-info}/RECORD +49 -37
- {magic_hour-0.39.0.dist-info → magic_hour-0.40.0.dist-info}/LICENSE +0 -0
- {magic_hour-0.39.0.dist-info → magic_hour-0.40.0.dist-info}/WHEEL +0 -0
magic_hour/README.md
CHANGED
|
@@ -14,7 +14,9 @@
|
|
|
14
14
|
- [ai_photo_editor](resources/v1/ai_photo_editor/README.md) - ai_photo_editor
|
|
15
15
|
- [ai_qr_code_generator](resources/v1/ai_qr_code_generator/README.md) - ai_qr_code_generator
|
|
16
16
|
- [ai_talking_photo](resources/v1/ai_talking_photo/README.md) - ai_talking_photo
|
|
17
|
+
- [ai_voice_generator](resources/v1/ai_voice_generator/README.md) - ai_voice_generator
|
|
17
18
|
- [animation](resources/v1/animation/README.md) - animation
|
|
19
|
+
- [audio_projects](resources/v1/audio_projects/README.md) - audio_projects
|
|
18
20
|
- [auto_subtitle_generator](resources/v1/auto_subtitle_generator/README.md) - auto_subtitle_generator
|
|
19
21
|
- [face_detection](resources/v1/face_detection/README.md) - face_detection
|
|
20
22
|
- [face_swap](resources/v1/face_swap/README.md) - face_swap
|
magic_hour/environment.py
CHANGED
|
@@ -6,7 +6,7 @@ class Environment(enum.Enum):
|
|
|
6
6
|
"""Pre-defined base URLs for the API"""
|
|
7
7
|
|
|
8
8
|
ENVIRONMENT = "https://api.magichour.ai"
|
|
9
|
-
MOCK_SERVER = "https://api.sideko.dev/v1/mock/magichour/magic-hour/0.
|
|
9
|
+
MOCK_SERVER = "https://api.sideko.dev/v1/mock/magichour/magic-hour/0.40.0"
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
def _get_base_url(
|
|
@@ -14,7 +14,9 @@
|
|
|
14
14
|
- [ai_photo_editor](ai_photo_editor/README.md) - ai_photo_editor
|
|
15
15
|
- [ai_qr_code_generator](ai_qr_code_generator/README.md) - ai_qr_code_generator
|
|
16
16
|
- [ai_talking_photo](ai_talking_photo/README.md) - ai_talking_photo
|
|
17
|
+
- [ai_voice_generator](ai_voice_generator/README.md) - ai_voice_generator
|
|
17
18
|
- [animation](animation/README.md) - animation
|
|
19
|
+
- [audio_projects](audio_projects/README.md) - audio_projects
|
|
18
20
|
- [auto_subtitle_generator](auto_subtitle_generator/README.md) - auto_subtitle_generator
|
|
19
21
|
- [face_detection](face_detection/README.md) - face_detection
|
|
20
22
|
- [face_swap](face_swap/README.md) - face_swap
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# v1.ai_voice_generator
|
|
2
|
+
|
|
3
|
+
## Module Functions
|
|
4
|
+
|
|
5
|
+
### AI Voice Generator <a name="create"></a>
|
|
6
|
+
|
|
7
|
+
Generate speech from text. Each character costs 0.05 credits. The cost is rounded up to the nearest whole number.
|
|
8
|
+
|
|
9
|
+
**API Endpoint**: `POST /v1/ai-voice-generator`
|
|
10
|
+
|
|
11
|
+
#### Parameters
|
|
12
|
+
|
|
13
|
+
| Parameter | Required | Description | Example |
|
|
14
|
+
|-----------|:--------:|-------------|--------|
|
|
15
|
+
| `style` | ✓ | The content used to generate speech. | `{"prompt": "Hello, how are you?", "voice_name": "Elon Musk"}` |
|
|
16
|
+
| `└─ prompt` | ✓ | Text used to generate speech. Starter tier users can use up to 200 characters, while Creator, Pro, or Business users can use up to 1000. | `"Hello, how are you?"` |
|
|
17
|
+
| `└─ voice_name` | ✓ | The voice to use for the speech. Available voices: Elon Musk, Mark Zuckerberg, Joe Rogan, Barack Obama, Morgan Freeman, Kanye West, Donald Trump, Joe Biden, Kim Kardashian, Taylor Swift | `"Elon Musk"` |
|
|
18
|
+
| `name` | ✗ | The name of audio. This value is mainly used for your own identification of the audio. | `"Voice Generator audio"` |
|
|
19
|
+
|
|
20
|
+
#### Synchronous Client
|
|
21
|
+
|
|
22
|
+
```python
|
|
23
|
+
from magic_hour import Client
|
|
24
|
+
from os import getenv
|
|
25
|
+
|
|
26
|
+
client = Client(token=getenv("API_TOKEN"))
|
|
27
|
+
res = client.v1.ai_voice_generator.create(
|
|
28
|
+
style={"prompt": "Hello, how are you?", "voice_name": "Elon Musk"},
|
|
29
|
+
name="Voice Generator audio",
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
#### Asynchronous Client
|
|
35
|
+
|
|
36
|
+
```python
|
|
37
|
+
from magic_hour import AsyncClient
|
|
38
|
+
from os import getenv
|
|
39
|
+
|
|
40
|
+
client = AsyncClient(token=getenv("API_TOKEN"))
|
|
41
|
+
res = await client.v1.ai_voice_generator.create(
|
|
42
|
+
style={"prompt": "Hello, how are you?", "voice_name": "Elon Musk"},
|
|
43
|
+
name="Voice Generator audio",
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
#### Response
|
|
49
|
+
|
|
50
|
+
##### Type
|
|
51
|
+
[V1AiVoiceGeneratorCreateResponse](/magic_hour/types/models/v1_ai_voice_generator_create_response.py)
|
|
52
|
+
|
|
53
|
+
##### Example
|
|
54
|
+
`{"credits_charged": 1, "id": "cuid-example"}`
|
|
55
|
+
|
|
56
|
+
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import typing
|
|
2
|
+
|
|
3
|
+
from magic_hour.types import models, params
|
|
4
|
+
from make_api_request import (
|
|
5
|
+
AsyncBaseClient,
|
|
6
|
+
RequestOptions,
|
|
7
|
+
SyncBaseClient,
|
|
8
|
+
default_request_options,
|
|
9
|
+
to_encodable,
|
|
10
|
+
type_utils,
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class AiVoiceGeneratorClient:
|
|
15
|
+
def __init__(self, *, base_client: SyncBaseClient):
|
|
16
|
+
self._base_client = base_client
|
|
17
|
+
|
|
18
|
+
def create(
|
|
19
|
+
self,
|
|
20
|
+
*,
|
|
21
|
+
style: params.V1AiVoiceGeneratorCreateBodyStyle,
|
|
22
|
+
name: typing.Union[
|
|
23
|
+
typing.Optional[str], type_utils.NotGiven
|
|
24
|
+
] = type_utils.NOT_GIVEN,
|
|
25
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
26
|
+
) -> models.V1AiVoiceGeneratorCreateResponse:
|
|
27
|
+
"""
|
|
28
|
+
AI Voice Generator
|
|
29
|
+
|
|
30
|
+
Generate speech from text. Each character costs 0.05 credits. The cost is rounded up to the nearest whole number.
|
|
31
|
+
|
|
32
|
+
POST /v1/ai-voice-generator
|
|
33
|
+
|
|
34
|
+
Args:
|
|
35
|
+
name: The name of audio. This value is mainly used for your own identification of the audio.
|
|
36
|
+
style: The content used to generate speech.
|
|
37
|
+
request_options: Additional options to customize the HTTP request
|
|
38
|
+
|
|
39
|
+
Returns:
|
|
40
|
+
Success
|
|
41
|
+
|
|
42
|
+
Raises:
|
|
43
|
+
ApiError: A custom exception class that provides additional context
|
|
44
|
+
for API errors, including the HTTP status code and response body.
|
|
45
|
+
|
|
46
|
+
Examples:
|
|
47
|
+
```py
|
|
48
|
+
client.v1.ai_voice_generator.create(
|
|
49
|
+
style={"prompt": "Hello, how are you?", "voice_name": "Elon Musk"},
|
|
50
|
+
name="Voice Generator audio",
|
|
51
|
+
)
|
|
52
|
+
```
|
|
53
|
+
"""
|
|
54
|
+
_json = to_encodable(
|
|
55
|
+
item={"name": name, "style": style},
|
|
56
|
+
dump_with=params._SerializerV1AiVoiceGeneratorCreateBody,
|
|
57
|
+
)
|
|
58
|
+
return self._base_client.request(
|
|
59
|
+
method="POST",
|
|
60
|
+
path="/v1/ai-voice-generator",
|
|
61
|
+
auth_names=["bearerAuth"],
|
|
62
|
+
json=_json,
|
|
63
|
+
cast_to=models.V1AiVoiceGeneratorCreateResponse,
|
|
64
|
+
request_options=request_options or default_request_options(),
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
class AsyncAiVoiceGeneratorClient:
|
|
69
|
+
def __init__(self, *, base_client: AsyncBaseClient):
|
|
70
|
+
self._base_client = base_client
|
|
71
|
+
|
|
72
|
+
async def create(
|
|
73
|
+
self,
|
|
74
|
+
*,
|
|
75
|
+
style: params.V1AiVoiceGeneratorCreateBodyStyle,
|
|
76
|
+
name: typing.Union[
|
|
77
|
+
typing.Optional[str], type_utils.NotGiven
|
|
78
|
+
] = type_utils.NOT_GIVEN,
|
|
79
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
80
|
+
) -> models.V1AiVoiceGeneratorCreateResponse:
|
|
81
|
+
"""
|
|
82
|
+
AI Voice Generator
|
|
83
|
+
|
|
84
|
+
Generate speech from text. Each character costs 0.05 credits. The cost is rounded up to the nearest whole number.
|
|
85
|
+
|
|
86
|
+
POST /v1/ai-voice-generator
|
|
87
|
+
|
|
88
|
+
Args:
|
|
89
|
+
name: The name of audio. This value is mainly used for your own identification of the audio.
|
|
90
|
+
style: The content used to generate speech.
|
|
91
|
+
request_options: Additional options to customize the HTTP request
|
|
92
|
+
|
|
93
|
+
Returns:
|
|
94
|
+
Success
|
|
95
|
+
|
|
96
|
+
Raises:
|
|
97
|
+
ApiError: A custom exception class that provides additional context
|
|
98
|
+
for API errors, including the HTTP status code and response body.
|
|
99
|
+
|
|
100
|
+
Examples:
|
|
101
|
+
```py
|
|
102
|
+
await client.v1.ai_voice_generator.create(
|
|
103
|
+
style={"prompt": "Hello, how are you?", "voice_name": "Elon Musk"},
|
|
104
|
+
name="Voice Generator audio",
|
|
105
|
+
)
|
|
106
|
+
```
|
|
107
|
+
"""
|
|
108
|
+
_json = to_encodable(
|
|
109
|
+
item={"name": name, "style": style},
|
|
110
|
+
dump_with=params._SerializerV1AiVoiceGeneratorCreateBody,
|
|
111
|
+
)
|
|
112
|
+
return await self._base_client.request(
|
|
113
|
+
method="POST",
|
|
114
|
+
path="/v1/ai-voice-generator",
|
|
115
|
+
auth_names=["bearerAuth"],
|
|
116
|
+
json=_json,
|
|
117
|
+
cast_to=models.V1AiVoiceGeneratorCreateResponse,
|
|
118
|
+
request_options=request_options or default_request_options(),
|
|
119
|
+
)
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# v1.audio_projects
|
|
2
|
+
|
|
3
|
+
## Module Functions
|
|
4
|
+
|
|
5
|
+
### Delete audio <a name="delete"></a>
|
|
6
|
+
|
|
7
|
+
Permanently delete the rendered audio file(s). This action is not reversible, please be sure before deleting.
|
|
8
|
+
|
|
9
|
+
**API Endpoint**: `DELETE /v1/audio-projects/{id}`
|
|
10
|
+
|
|
11
|
+
#### Parameters
|
|
12
|
+
|
|
13
|
+
| Parameter | Required | Description | Example |
|
|
14
|
+
|-----------|:--------:|-------------|--------|
|
|
15
|
+
| `id` | ✓ | Unique ID of the audio project. This value is returned by all of the POST APIs that create an audio. | `"cuid-example"` |
|
|
16
|
+
|
|
17
|
+
#### Synchronous Client
|
|
18
|
+
|
|
19
|
+
```python
|
|
20
|
+
from magic_hour import Client
|
|
21
|
+
from os import getenv
|
|
22
|
+
|
|
23
|
+
client = Client(token=getenv("API_TOKEN"))
|
|
24
|
+
res = client.v1.audio_projects.delete(id="cuid-example")
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
#### Asynchronous Client
|
|
29
|
+
|
|
30
|
+
```python
|
|
31
|
+
from magic_hour import AsyncClient
|
|
32
|
+
from os import getenv
|
|
33
|
+
|
|
34
|
+
client = AsyncClient(token=getenv("API_TOKEN"))
|
|
35
|
+
res = await client.v1.audio_projects.delete(id="cuid-example")
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Get audio details <a name="get"></a>
|
|
40
|
+
|
|
41
|
+
Get the details of a audio project. The `downloads` field will be empty unless the audio was successfully rendered.
|
|
42
|
+
|
|
43
|
+
The audio can be one of the following status
|
|
44
|
+
- `draft` - not currently used
|
|
45
|
+
- `queued` - the job is queued and waiting for a GPU
|
|
46
|
+
- `rendering` - the generation is in progress
|
|
47
|
+
- `complete` - the audio is successful created
|
|
48
|
+
- `error` - an error occurred during rendering
|
|
49
|
+
- `canceled` - audio render is canceled by the user
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
**API Endpoint**: `GET /v1/audio-projects/{id}`
|
|
53
|
+
|
|
54
|
+
#### Parameters
|
|
55
|
+
|
|
56
|
+
| Parameter | Required | Description | Example |
|
|
57
|
+
|-----------|:--------:|-------------|--------|
|
|
58
|
+
| `id` | ✓ | Unique ID of the audio project. This value is returned by all of the POST APIs that create an audio. | `"cuid-example"` |
|
|
59
|
+
|
|
60
|
+
#### Synchronous Client
|
|
61
|
+
|
|
62
|
+
```python
|
|
63
|
+
from magic_hour import Client
|
|
64
|
+
from os import getenv
|
|
65
|
+
|
|
66
|
+
client = Client(token=getenv("API_TOKEN"))
|
|
67
|
+
res = client.v1.audio_projects.get(id="cuid-example")
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
#### Asynchronous Client
|
|
72
|
+
|
|
73
|
+
```python
|
|
74
|
+
from magic_hour import AsyncClient
|
|
75
|
+
from os import getenv
|
|
76
|
+
|
|
77
|
+
client = AsyncClient(token=getenv("API_TOKEN"))
|
|
78
|
+
res = await client.v1.audio_projects.get(id="cuid-example")
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
#### Response
|
|
83
|
+
|
|
84
|
+
##### Type
|
|
85
|
+
[V1AudioProjectsGetResponse](/magic_hour/types/models/v1_audio_projects_get_response.py)
|
|
86
|
+
|
|
87
|
+
##### Example
|
|
88
|
+
`{"created_at": "1970-01-01T00:00:00", "credits_charged": 2, "downloads": [{"expires_at": "2024-10-19T05:16:19.027Z", "url": "https://videos.magichour.ai/id/output.wav"}], "enabled": True, "error": {"code": "no_source_face", "message": "Please use an image with a detectable face"}, "id": "cuid-example", "name": "Example Name", "status": "complete", "type_": "VOICE_GENERATOR"}`
|
|
89
|
+
|
|
90
|
+
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import typing
|
|
2
|
+
|
|
3
|
+
from magic_hour.types import models
|
|
4
|
+
from make_api_request import (
|
|
5
|
+
AsyncBaseClient,
|
|
6
|
+
RequestOptions,
|
|
7
|
+
SyncBaseClient,
|
|
8
|
+
default_request_options,
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class AudioProjectsClient:
|
|
13
|
+
def __init__(self, *, base_client: SyncBaseClient):
|
|
14
|
+
self._base_client = base_client
|
|
15
|
+
|
|
16
|
+
def delete(
|
|
17
|
+
self, *, id: str, request_options: typing.Optional[RequestOptions] = None
|
|
18
|
+
) -> None:
|
|
19
|
+
"""
|
|
20
|
+
Delete audio
|
|
21
|
+
|
|
22
|
+
Permanently delete the rendered audio file(s). This action is not reversible, please be sure before deleting.
|
|
23
|
+
|
|
24
|
+
DELETE /v1/audio-projects/{id}
|
|
25
|
+
|
|
26
|
+
Args:
|
|
27
|
+
id: Unique ID of the audio project. This value is returned by all of the POST APIs that create an audio.
|
|
28
|
+
request_options: Additional options to customize the HTTP request
|
|
29
|
+
|
|
30
|
+
Returns:
|
|
31
|
+
204
|
|
32
|
+
|
|
33
|
+
Raises:
|
|
34
|
+
ApiError: A custom exception class that provides additional context
|
|
35
|
+
for API errors, including the HTTP status code and response body.
|
|
36
|
+
|
|
37
|
+
Examples:
|
|
38
|
+
```py
|
|
39
|
+
client.v1.audio_projects.delete(id="cuid-example")
|
|
40
|
+
```
|
|
41
|
+
"""
|
|
42
|
+
self._base_client.request(
|
|
43
|
+
method="DELETE",
|
|
44
|
+
path=f"/v1/audio-projects/{id}",
|
|
45
|
+
auth_names=["bearerAuth"],
|
|
46
|
+
cast_to=type(None),
|
|
47
|
+
request_options=request_options or default_request_options(),
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
def get(
|
|
51
|
+
self, *, id: str, request_options: typing.Optional[RequestOptions] = None
|
|
52
|
+
) -> models.V1AudioProjectsGetResponse:
|
|
53
|
+
"""
|
|
54
|
+
Get audio details
|
|
55
|
+
|
|
56
|
+
Get the details of a audio project. The `downloads` field will be empty unless the audio was successfully rendered.
|
|
57
|
+
|
|
58
|
+
The audio can be one of the following status
|
|
59
|
+
- `draft` - not currently used
|
|
60
|
+
- `queued` - the job is queued and waiting for a GPU
|
|
61
|
+
- `rendering` - the generation is in progress
|
|
62
|
+
- `complete` - the audio is successful created
|
|
63
|
+
- `error` - an error occurred during rendering
|
|
64
|
+
- `canceled` - audio render is canceled by the user
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
GET /v1/audio-projects/{id}
|
|
68
|
+
|
|
69
|
+
Args:
|
|
70
|
+
id: Unique ID of the audio project. This value is returned by all of the POST APIs that create an audio.
|
|
71
|
+
request_options: Additional options to customize the HTTP request
|
|
72
|
+
|
|
73
|
+
Returns:
|
|
74
|
+
Success
|
|
75
|
+
|
|
76
|
+
Raises:
|
|
77
|
+
ApiError: A custom exception class that provides additional context
|
|
78
|
+
for API errors, including the HTTP status code and response body.
|
|
79
|
+
|
|
80
|
+
Examples:
|
|
81
|
+
```py
|
|
82
|
+
client.v1.audio_projects.get(id="cuid-example")
|
|
83
|
+
```
|
|
84
|
+
"""
|
|
85
|
+
return self._base_client.request(
|
|
86
|
+
method="GET",
|
|
87
|
+
path=f"/v1/audio-projects/{id}",
|
|
88
|
+
auth_names=["bearerAuth"],
|
|
89
|
+
cast_to=models.V1AudioProjectsGetResponse,
|
|
90
|
+
request_options=request_options or default_request_options(),
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
class AsyncAudioProjectsClient:
|
|
95
|
+
def __init__(self, *, base_client: AsyncBaseClient):
|
|
96
|
+
self._base_client = base_client
|
|
97
|
+
|
|
98
|
+
async def delete(
|
|
99
|
+
self, *, id: str, request_options: typing.Optional[RequestOptions] = None
|
|
100
|
+
) -> None:
|
|
101
|
+
"""
|
|
102
|
+
Delete audio
|
|
103
|
+
|
|
104
|
+
Permanently delete the rendered audio file(s). This action is not reversible, please be sure before deleting.
|
|
105
|
+
|
|
106
|
+
DELETE /v1/audio-projects/{id}
|
|
107
|
+
|
|
108
|
+
Args:
|
|
109
|
+
id: Unique ID of the audio project. This value is returned by all of the POST APIs that create an audio.
|
|
110
|
+
request_options: Additional options to customize the HTTP request
|
|
111
|
+
|
|
112
|
+
Returns:
|
|
113
|
+
204
|
|
114
|
+
|
|
115
|
+
Raises:
|
|
116
|
+
ApiError: A custom exception class that provides additional context
|
|
117
|
+
for API errors, including the HTTP status code and response body.
|
|
118
|
+
|
|
119
|
+
Examples:
|
|
120
|
+
```py
|
|
121
|
+
await client.v1.audio_projects.delete(id="cuid-example")
|
|
122
|
+
```
|
|
123
|
+
"""
|
|
124
|
+
await self._base_client.request(
|
|
125
|
+
method="DELETE",
|
|
126
|
+
path=f"/v1/audio-projects/{id}",
|
|
127
|
+
auth_names=["bearerAuth"],
|
|
128
|
+
cast_to=type(None),
|
|
129
|
+
request_options=request_options or default_request_options(),
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
async def get(
|
|
133
|
+
self, *, id: str, request_options: typing.Optional[RequestOptions] = None
|
|
134
|
+
) -> models.V1AudioProjectsGetResponse:
|
|
135
|
+
"""
|
|
136
|
+
Get audio details
|
|
137
|
+
|
|
138
|
+
Get the details of a audio project. The `downloads` field will be empty unless the audio was successfully rendered.
|
|
139
|
+
|
|
140
|
+
The audio can be one of the following status
|
|
141
|
+
- `draft` - not currently used
|
|
142
|
+
- `queued` - the job is queued and waiting for a GPU
|
|
143
|
+
- `rendering` - the generation is in progress
|
|
144
|
+
- `complete` - the audio is successful created
|
|
145
|
+
- `error` - an error occurred during rendering
|
|
146
|
+
- `canceled` - audio render is canceled by the user
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
GET /v1/audio-projects/{id}
|
|
150
|
+
|
|
151
|
+
Args:
|
|
152
|
+
id: Unique ID of the audio project. This value is returned by all of the POST APIs that create an audio.
|
|
153
|
+
request_options: Additional options to customize the HTTP request
|
|
154
|
+
|
|
155
|
+
Returns:
|
|
156
|
+
Success
|
|
157
|
+
|
|
158
|
+
Raises:
|
|
159
|
+
ApiError: A custom exception class that provides additional context
|
|
160
|
+
for API errors, including the HTTP status code and response body.
|
|
161
|
+
|
|
162
|
+
Examples:
|
|
163
|
+
```py
|
|
164
|
+
await client.v1.audio_projects.get(id="cuid-example")
|
|
165
|
+
```
|
|
166
|
+
"""
|
|
167
|
+
return await self._base_client.request(
|
|
168
|
+
method="GET",
|
|
169
|
+
path=f"/v1/audio-projects/{id}",
|
|
170
|
+
auth_names=["bearerAuth"],
|
|
171
|
+
cast_to=models.V1AudioProjectsGetResponse,
|
|
172
|
+
request_options=request_options or default_request_options(),
|
|
173
|
+
)
|
|
@@ -42,7 +42,15 @@ from magic_hour.resources.v1.ai_talking_photo import (
|
|
|
42
42
|
AiTalkingPhotoClient,
|
|
43
43
|
AsyncAiTalkingPhotoClient,
|
|
44
44
|
)
|
|
45
|
+
from magic_hour.resources.v1.ai_voice_generator import (
|
|
46
|
+
AiVoiceGeneratorClient,
|
|
47
|
+
AsyncAiVoiceGeneratorClient,
|
|
48
|
+
)
|
|
45
49
|
from magic_hour.resources.v1.animation import AnimationClient, AsyncAnimationClient
|
|
50
|
+
from magic_hour.resources.v1.audio_projects import (
|
|
51
|
+
AsyncAudioProjectsClient,
|
|
52
|
+
AudioProjectsClient,
|
|
53
|
+
)
|
|
46
54
|
from magic_hour.resources.v1.auto_subtitle_generator import (
|
|
47
55
|
AsyncAutoSubtitleGeneratorClient,
|
|
48
56
|
AutoSubtitleGeneratorClient,
|
|
@@ -125,6 +133,8 @@ class V1Client:
|
|
|
125
133
|
self.photo_colorizer = PhotoColorizerClient(base_client=self._base_client)
|
|
126
134
|
self.text_to_video = TextToVideoClient(base_client=self._base_client)
|
|
127
135
|
self.video_to_video = VideoToVideoClient(base_client=self._base_client)
|
|
136
|
+
self.audio_projects = AudioProjectsClient(base_client=self._base_client)
|
|
137
|
+
self.ai_voice_generator = AiVoiceGeneratorClient(base_client=self._base_client)
|
|
128
138
|
|
|
129
139
|
|
|
130
140
|
class AsyncV1Client:
|
|
@@ -171,3 +181,7 @@ class AsyncV1Client:
|
|
|
171
181
|
self.photo_colorizer = AsyncPhotoColorizerClient(base_client=self._base_client)
|
|
172
182
|
self.text_to_video = AsyncTextToVideoClient(base_client=self._base_client)
|
|
173
183
|
self.video_to_video = AsyncVideoToVideoClient(base_client=self._base_client)
|
|
184
|
+
self.audio_projects = AsyncAudioProjectsClient(base_client=self._base_client)
|
|
185
|
+
self.ai_voice_generator = AsyncAiVoiceGeneratorClient(
|
|
186
|
+
base_client=self._base_client
|
|
187
|
+
)
|