Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .sdk.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"id": "2db416fc-d566-4b6b-a6a2-d7d8e5e2be0e",
"id": "a29c33ac-83f8-4c7a-b921-cbe31c36a530",
"tracked_paths": [
{
"editable": true,
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ download_urls = result.downloads
### [v1.audio_to_video](magic_hour/resources/v1/audio_to_video/README.md)

- [create](magic_hour/resources/v1/audio_to_video/README.md#create) - Audio-to-Video
- [generate](magic_hour/resources/v1/audio_to_video/README.md#generate) - Audio To Video Generate Workflow

### [v1.auto_subtitle_generator](magic_hour/resources/v1/auto_subtitle_generator/README.md)

Expand Down
2 changes: 1 addition & 1 deletion magic_hour/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class Environment(enum.Enum):
"""Pre-defined base URLs for the API"""

ENVIRONMENT = "https://api.magichour.ai"
MOCK_SERVER = "https://api.sideko.dev/v1/mock/magichour/magic-hour/0.64.0"
MOCK_SERVER = "https://api.sideko.dev/v1/mock/magichour/magic-hour/0.65.0"


def _get_base_url(
Expand Down
9 changes: 5 additions & 4 deletions magic_hour/resources/v1/ai_image_upscaler/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,9 @@ Upscale your image using AI. Each 2x upscale costs 50 credits, and 4x upscale co
| `assets` | ✓ | Provide the assets for upscaling | `{"image_file_path": "api-assets/id/1234.png"}` |
| `└─ image_file_path` | ✓ | The image to upscale. 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). See the [file upload guide](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls#input-file) for details. . The maximum input image size is 4096x4096px. | `"api-assets/id/1234.png"` |
| `scale_factor` | ✓ | How much to scale the image. Must be either 2 or 4. Note: 4x upscale is only available on Creator, Pro, or Business tier. | `2.0` |
| `style` | ✓ | | `{"enhancement": "Balanced"}` |
| `└─ enhancement` | ✓ | | `"Balanced"` |
| `style` | ✓ | Style settings for the upscale. Use `mode` to select between `"pro"` (faster, no enhancement required) and `"creative"` (defaults to `"Balanced"` enhancement). Defaults to `"creative"`. | `{"mode": "creative"}` |
| `└─ enhancement` | ✗ | | `"Balanced"` |
| `└─ mode` | ✗ | The upscaling mode. `"pro"` is faster and does not require `enhancement`. `"creative"` requires `enhancement`. Defaults to `"creative"`. | `"creative"` |
| `└─ prompt` | ✗ | A prompt to guide the final image. This value is ignored if `enhancement` is not Creative | `"string"` |
| `name` | ✗ | Give your image a custom name for easy identification. | `"My Image Upscaler image"` |

Expand All @@ -90,7 +91,7 @@ client = Client(token=getenv("API_TOKEN"))
res = client.v1.ai_image_upscaler.create(
assets={"image_file_path": "api-assets/id/1234.png"},
scale_factor=2.0,
style={"enhancement": "Balanced"},
style={"mode": "creative"},
name="My Image Upscaler image",
)
```
Expand All @@ -105,7 +106,7 @@ client = AsyncClient(token=getenv("API_TOKEN"))
res = await client.v1.ai_image_upscaler.create(
assets={"image_file_path": "api-assets/id/1234.png"},
scale_factor=2.0,
style={"enhancement": "Balanced"},
style={"mode": "creative"},
name="My Image Upscaler image",
)
```
Expand Down
8 changes: 4 additions & 4 deletions magic_hour/resources/v1/ai_image_upscaler/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def create(
scale_factor: How much to scale the image. Must be either 2 or 4.

Note: 4x upscale is only available on Creator, Pro, or Business tier.
style: V1AiImageUpscalerCreateBodyStyle
style: Style settings for the upscale. Use `mode` to select between `"pro"` (faster, no enhancement required) and `"creative"` (defaults to `"Balanced"` enhancement). Defaults to `"creative"`.
request_options: Additional options to customize the HTTP request

Returns:
Expand All @@ -133,7 +133,7 @@ def create(
client.v1.ai_image_upscaler.create(
assets={"image_file_path": "api-assets/id/1234.png"},
scale_factor=2.0,
style={"enhancement": "Balanced"},
style={"mode": "creative"},
name="My Image Upscaler image",
)
```
Expand Down Expand Up @@ -255,7 +255,7 @@ async def create(
scale_factor: How much to scale the image. Must be either 2 or 4.

Note: 4x upscale is only available on Creator, Pro, or Business tier.
style: V1AiImageUpscalerCreateBodyStyle
style: Style settings for the upscale. Use `mode` to select between `"pro"` (faster, no enhancement required) and `"creative"` (defaults to `"Balanced"` enhancement). Defaults to `"creative"`.
request_options: Additional options to customize the HTTP request

Returns:
Expand All @@ -270,7 +270,7 @@ async def create(
await client.v1.ai_image_upscaler.create(
assets={"image_file_path": "api-assets/id/1234.png"},
scale_factor=2.0,
style={"enhancement": "Balanced"},
style={"mode": "creative"},
name="My Image Upscaler image",
)
```
Expand Down
4 changes: 2 additions & 2 deletions magic_hour/resources/v1/ai_talking_photo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ Create a talking photo from an image and audio or text input.
| `assets` | ✓ | Provide the assets for creating a talking photo | `{"audio_file_path": "api-assets/id/1234.mp3", "image_file_path": "api-assets/id/1234.png"}` |
| `└─ audio_file_path` | ✓ | The audio file to sync with the image. 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). See the [file upload guide](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls#input-file) for details. | `"api-assets/id/1234.mp3"` |
| `└─ image_file_path` | ✓ | The source image to animate. 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). See the [file upload guide](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls#input-file) for details. | `"api-assets/id/1234.png"` |
| `end_seconds` | ✓ | The end time of the input audio in seconds. The maximum duration allowed is 60 seconds. | `15.0` |
| `start_seconds` | ✓ | The start time of the input audio in seconds. The maximum duration allowed is 60 seconds. | `0.0` |
| `end_seconds` | ✓ | The end time of the input audio in seconds. Maximum clip length depends on style.generation_mode: realistic 180s, prompted 45s. | `15.0` |
| `start_seconds` | ✓ | The start time of the input audio in seconds. Maximum clip length depends on style.generation_mode: realistic 180s, prompted 45s. | `0.0` |
| `max_resolution` | ✗ | Constrains the larger dimension (height or width) of the output video. Allows you to set a lower resolution than your plan's maximum if desired. The value is capped by your plan's max resolution. | `1024` |
| `name` | ✗ | Give your image a custom name for easy identification. | `"My Talking Photo image"` |
| `style` | ✗ | Attributes used to dictate the style of the output | `{"generation_mode": "realistic"}` |
Expand Down
8 changes: 4 additions & 4 deletions magic_hour/resources/v1/ai_talking_photo/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ def create(
name: Give your image a custom name for easy identification.
style: Attributes used to dictate the style of the output
assets: Provide the assets for creating a talking photo
end_seconds: The end time of the input audio in seconds. The maximum duration allowed is 60 seconds.
start_seconds: The start time of the input audio in seconds. The maximum duration allowed is 60 seconds.
end_seconds: The end time of the input audio in seconds. Maximum clip length depends on style.generation_mode: realistic 180s, prompted 45s.
start_seconds: The start time of the input audio in seconds. Maximum clip length depends on style.generation_mode: realistic 180s, prompted 45s.
request_options: Additional options to customize the HTTP request

Returns:
Expand Down Expand Up @@ -302,8 +302,8 @@ async def create(
name: Give your image a custom name for easy identification.
style: Attributes used to dictate the style of the output
assets: Provide the assets for creating a talking photo
end_seconds: The end time of the input audio in seconds. The maximum duration allowed is 60 seconds.
start_seconds: The start time of the input audio in seconds. The maximum duration allowed is 60 seconds.
end_seconds: The end time of the input audio in seconds. Maximum clip length depends on style.generation_mode: realistic 180s, prompted 45s.
start_seconds: The start time of the input audio in seconds. Maximum clip length depends on style.generation_mode: realistic 180s, prompted 45s.
request_options: Additional options to customize the HTTP request

Returns:
Expand Down
3 changes: 3 additions & 0 deletions magic_hour/types/params/v1_ai_image_upscaler_create_body.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ class V1AiImageUpscalerCreateBody(typing_extensions.TypedDict):
"""

style: typing_extensions.Required[V1AiImageUpscalerCreateBodyStyle]
"""
Style settings for the upscale. Use `mode` to select between `"pro"` (faster, no enhancement required) and `"creative"` (defaults to `"Balanced"` enhancement). Defaults to `"creative"`.
"""


class _SerializerV1AiImageUpscalerCreateBody(pydantic.BaseModel):
Expand Down
18 changes: 12 additions & 6 deletions magic_hour/types/params/v1_ai_image_upscaler_create_body_style.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,18 @@

class V1AiImageUpscalerCreateBodyStyle(typing_extensions.TypedDict):
"""
V1AiImageUpscalerCreateBodyStyle
Style settings for the upscale. Use `mode` to select between `"pro"` (faster, no enhancement required) and `"creative"` (defaults to `"Balanced"` enhancement). Defaults to `"creative"`.
"""

enhancement: typing_extensions.Required[
enhancement: typing_extensions.NotRequired[
typing_extensions.Literal["Balanced", "Creative", "Resemblance"]
]

mode: typing_extensions.NotRequired[typing_extensions.Literal["creative", "pro"]]
"""
The upscaling mode. `"pro"` is faster and does not require `enhancement`. `"creative"` requires `enhancement`. Defaults to `"creative"`.
"""

prompt: typing_extensions.NotRequired[str]
"""
A prompt to guide the final image. This value is ignored if `enhancement` is not Creative
Expand All @@ -28,9 +33,10 @@ class _SerializerV1AiImageUpscalerCreateBodyStyle(pydantic.BaseModel):
populate_by_name=True,
)

enhancement: typing_extensions.Literal["Balanced", "Creative", "Resemblance"] = (
pydantic.Field(
alias="enhancement",
)
enhancement: typing.Optional[
typing_extensions.Literal["Balanced", "Creative", "Resemblance"]
] = pydantic.Field(alias="enhancement", default=None)
mode: typing.Optional[typing_extensions.Literal["creative", "pro"]] = (
pydantic.Field(alias="mode", default=None)
)
prompt: typing.Optional[str] = pydantic.Field(alias="prompt", default=None)
4 changes: 2 additions & 2 deletions magic_hour/types/params/v1_ai_talking_photo_create_body.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class V1AiTalkingPhotoCreateBody(typing_extensions.TypedDict):

end_seconds: typing_extensions.Required[float]
"""
The end time of the input audio in seconds. The maximum duration allowed is 60 seconds.
The end time of the input audio in seconds. Maximum clip length depends on style.generation_mode: realistic 180s, prompted 45s.
"""

max_resolution: typing_extensions.NotRequired[int]
Expand All @@ -39,7 +39,7 @@ class V1AiTalkingPhotoCreateBody(typing_extensions.TypedDict):

start_seconds: typing_extensions.Required[float]
"""
The start time of the input audio in seconds. The maximum duration allowed is 60 seconds.
The start time of the input audio in seconds. Maximum clip length depends on style.generation_mode: realistic 180s, prompted 45s.
"""

style: typing_extensions.NotRequired[V1AiTalkingPhotoCreateBodyStyle]
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "magic_hour"
version = "0.64.0"
version = "0.65.0"
description = "Python SDK for Magic Hour API"
readme = "README.md"
authors = []
Expand Down
4 changes: 2 additions & 2 deletions tests/test_v1_ai_image_upscaler_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def test_create_200_success_all_params() -> None:
response = client.v1.ai_image_upscaler.create(
assets={"image_file_path": "api-assets/id/1234.png"},
scale_factor=2.0,
style={"enhancement": "Balanced", "prompt": "string"},
style={"enhancement": "Balanced", "mode": "creative", "prompt": "string"},
name="My Image Upscaler image",
)
try:
Expand Down Expand Up @@ -66,7 +66,7 @@ async def test_await_create_200_success_all_params() -> None:
response = await client.v1.ai_image_upscaler.create(
assets={"image_file_path": "api-assets/id/1234.png"},
scale_factor=2.0,
style={"enhancement": "Balanced", "prompt": "string"},
style={"enhancement": "Balanced", "mode": "creative", "prompt": "string"},
name="My Image Upscaler image",
)
try:
Expand Down
Loading