magic_hour 0.9.5__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 +34 -0
- magic_hour/__init__.py +1 -1
- magic_hour/client.py +8 -17
- magic_hour/environment.py +13 -1
- magic_hour/helpers/__init__.py +4 -0
- magic_hour/helpers/download.py +77 -0
- magic_hour/helpers/logger.py +8 -0
- magic_hour/resources/v1/README.md +32 -0
- magic_hour/resources/v1/ai_clothes_changer/README.md +94 -5
- magic_hour/resources/v1/ai_clothes_changer/client.py +161 -16
- magic_hour/resources/v1/ai_face_editor/README.md +195 -0
- magic_hour/resources/v1/ai_face_editor/__init__.py +4 -0
- magic_hour/resources/v1/ai_face_editor/client.py +324 -0
- magic_hour/resources/v1/ai_gif_generator/README.md +116 -0
- magic_hour/resources/v1/ai_gif_generator/__init__.py +4 -0
- magic_hour/resources/v1/ai_gif_generator/client.py +257 -0
- magic_hour/resources/v1/ai_headshot_generator/README.md +81 -3
- magic_hour/resources/v1/ai_headshot_generator/client.py +167 -18
- magic_hour/resources/v1/ai_image_editor/README.md +125 -0
- magic_hour/resources/v1/ai_image_editor/__init__.py +4 -0
- magic_hour/resources/v1/ai_image_editor/client.py +290 -0
- magic_hour/resources/v1/ai_image_generator/README.md +99 -5
- magic_hour/resources/v1/ai_image_generator/client.py +170 -24
- magic_hour/resources/v1/ai_image_upscaler/README.md +89 -3
- magic_hour/resources/v1/ai_image_upscaler/client.py +173 -20
- magic_hour/resources/v1/ai_meme_generator/README.md +129 -0
- magic_hour/resources/v1/ai_meme_generator/__init__.py +4 -0
- magic_hour/resources/v1/ai_meme_generator/client.py +253 -0
- magic_hour/resources/v1/ai_photo_editor/README.md +119 -4
- magic_hour/resources/v1/ai_photo_editor/client.py +199 -18
- magic_hour/resources/v1/ai_qr_code_generator/README.md +84 -3
- magic_hour/resources/v1/ai_qr_code_generator/client.py +140 -18
- magic_hour/resources/v1/ai_talking_photo/README.md +137 -0
- magic_hour/resources/v1/ai_talking_photo/__init__.py +4 -0
- magic_hour/resources/v1/ai_talking_photo/client.py +326 -0
- 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 +112 -0
- magic_hour/resources/v1/ai_voice_generator/__init__.py +4 -0
- magic_hour/resources/v1/ai_voice_generator/client.py +241 -0
- magic_hour/resources/v1/animation/README.md +128 -6
- magic_hour/resources/v1/animation/client.py +247 -22
- magic_hour/resources/v1/audio_projects/README.md +135 -0
- magic_hour/resources/v1/audio_projects/__init__.py +12 -0
- magic_hour/resources/v1/audio_projects/client.py +310 -0
- magic_hour/resources/v1/audio_projects/client_test.py +520 -0
- magic_hour/resources/v1/auto_subtitle_generator/README.md +128 -0
- magic_hour/resources/v1/auto_subtitle_generator/__init__.py +4 -0
- magic_hour/resources/v1/auto_subtitle_generator/client.py +346 -0
- magic_hour/resources/v1/client.py +75 -1
- magic_hour/resources/v1/face_detection/README.md +157 -0
- magic_hour/resources/v1/face_detection/__init__.py +12 -0
- magic_hour/resources/v1/face_detection/client.py +380 -0
- magic_hour/resources/v1/face_swap/README.md +137 -9
- magic_hour/resources/v1/face_swap/client.py +329 -38
- magic_hour/resources/v1/face_swap_photo/README.md +118 -3
- magic_hour/resources/v1/face_swap_photo/client.py +199 -14
- magic_hour/resources/v1/files/README.md +39 -0
- magic_hour/resources/v1/files/client.py +351 -1
- magic_hour/resources/v1/files/client_test.py +414 -0
- magic_hour/resources/v1/files/upload_urls/README.md +38 -17
- magic_hour/resources/v1/files/upload_urls/client.py +38 -34
- magic_hour/resources/v1/image_background_remover/README.md +96 -5
- magic_hour/resources/v1/image_background_remover/client.py +151 -16
- magic_hour/resources/v1/image_projects/README.md +82 -10
- magic_hour/resources/v1/image_projects/__init__.py +10 -2
- magic_hour/resources/v1/image_projects/client.py +154 -16
- magic_hour/resources/v1/image_projects/client_test.py +527 -0
- magic_hour/resources/v1/image_to_video/README.md +96 -11
- magic_hour/resources/v1/image_to_video/client.py +282 -38
- magic_hour/resources/v1/lip_sync/README.md +112 -9
- magic_hour/resources/v1/lip_sync/client.py +288 -34
- magic_hour/resources/v1/photo_colorizer/README.md +107 -0
- magic_hour/resources/v1/photo_colorizer/__init__.py +4 -0
- magic_hour/resources/v1/photo_colorizer/client.py +248 -0
- magic_hour/resources/v1/text_to_video/README.md +96 -7
- magic_hour/resources/v1/text_to_video/client.py +204 -18
- magic_hour/resources/v1/video_projects/README.md +81 -9
- magic_hour/resources/v1/video_projects/__init__.py +10 -2
- magic_hour/resources/v1/video_projects/client.py +151 -14
- magic_hour/resources/v1/video_projects/client_test.py +527 -0
- magic_hour/resources/v1/video_to_video/README.md +119 -15
- magic_hour/resources/v1/video_to_video/client.py +299 -46
- magic_hour/types/models/__init__.py +92 -56
- magic_hour/types/models/v1_ai_clothes_changer_create_response.py +33 -0
- magic_hour/types/models/v1_ai_face_editor_create_response.py +33 -0
- magic_hour/types/models/v1_ai_gif_generator_create_response.py +33 -0
- magic_hour/types/models/v1_ai_headshot_generator_create_response.py +33 -0
- magic_hour/types/models/v1_ai_image_editor_create_response.py +33 -0
- magic_hour/types/models/v1_ai_image_generator_create_response.py +33 -0
- magic_hour/types/models/v1_ai_image_upscaler_create_response.py +33 -0
- magic_hour/types/models/v1_ai_meme_generator_create_response.py +33 -0
- magic_hour/types/models/v1_ai_photo_editor_create_response.py +33 -0
- magic_hour/types/models/v1_ai_qr_code_generator_create_response.py +33 -0
- magic_hour/types/models/v1_ai_talking_photo_create_response.py +35 -0
- magic_hour/types/models/v1_ai_voice_cloner_create_response.py +27 -0
- magic_hour/types/models/v1_ai_voice_generator_create_response.py +27 -0
- magic_hour/types/models/v1_animation_create_response.py +35 -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/{get_v1_image_projects_id_response_error.py → v1_audio_projects_get_response_error.py} +2 -2
- magic_hour/types/models/v1_auto_subtitle_generator_create_response.py +35 -0
- magic_hour/types/models/v1_face_detection_create_response.py +25 -0
- magic_hour/types/models/v1_face_detection_get_response.py +45 -0
- magic_hour/types/models/v1_face_detection_get_response_faces_item.py +25 -0
- magic_hour/types/models/v1_face_swap_create_response.py +35 -0
- magic_hour/types/models/v1_face_swap_photo_create_response.py +33 -0
- magic_hour/types/models/v1_files_upload_urls_create_response.py +24 -0
- magic_hour/types/models/{post_v1_files_upload_urls_response_items_item.py → v1_files_upload_urls_create_response_items_item.py} +2 -2
- magic_hour/types/models/v1_image_background_remover_create_response.py +33 -0
- magic_hour/types/models/{get_v1_image_projects_id_response.py → v1_image_projects_get_response.py} +20 -18
- magic_hour/types/models/{get_v1_video_projects_id_response_downloads_item.py → v1_image_projects_get_response_downloads_item.py} +1 -1
- magic_hour/types/models/{get_v1_video_projects_id_response_error.py → v1_image_projects_get_response_error.py} +2 -2
- magic_hour/types/models/v1_image_to_video_create_response.py +35 -0
- magic_hour/types/models/v1_lip_sync_create_response.py +35 -0
- magic_hour/types/models/v1_photo_colorizer_create_response.py +33 -0
- magic_hour/types/models/v1_text_to_video_create_response.py +35 -0
- magic_hour/types/models/{get_v1_video_projects_id_response.py → v1_video_projects_get_response.py} +26 -23
- magic_hour/types/models/{get_v1_video_projects_id_response_download.py → v1_video_projects_get_response_download.py} +1 -1
- magic_hour/types/models/{get_v1_image_projects_id_response_downloads_item.py → v1_video_projects_get_response_downloads_item.py} +1 -1
- magic_hour/types/models/v1_video_projects_get_response_error.py +25 -0
- magic_hour/types/models/v1_video_to_video_create_response.py +35 -0
- magic_hour/types/params/__init__.py +422 -176
- magic_hour/types/params/v1_ai_clothes_changer_create_body.py +40 -0
- magic_hour/types/params/v1_ai_clothes_changer_create_body_assets.py +58 -0
- magic_hour/types/params/v1_ai_clothes_changer_generate_body_assets.py +33 -0
- magic_hour/types/params/v1_ai_face_editor_create_body.py +52 -0
- magic_hour/types/params/v1_ai_face_editor_create_body_assets.py +33 -0
- magic_hour/types/params/v1_ai_face_editor_create_body_style.py +137 -0
- magic_hour/types/params/v1_ai_face_editor_generate_body_assets.py +17 -0
- magic_hour/types/params/v1_ai_gif_generator_create_body.py +47 -0
- magic_hour/types/params/{post_v1_ai_image_generator_body_style.py → v1_ai_gif_generator_create_body_style.py} +5 -5
- magic_hour/types/params/v1_ai_headshot_generator_create_body.py +49 -0
- magic_hour/types/params/v1_ai_headshot_generator_create_body_assets.py +33 -0
- magic_hour/types/params/v1_ai_headshot_generator_create_body_style.py +27 -0
- magic_hour/types/params/v1_ai_headshot_generator_generate_body_assets.py +17 -0
- magic_hour/types/params/v1_ai_image_editor_create_body.py +49 -0
- magic_hour/types/params/v1_ai_image_editor_create_body_assets.py +47 -0
- magic_hour/types/params/v1_ai_image_editor_create_body_style.py +41 -0
- magic_hour/types/params/v1_ai_image_editor_generate_body_assets.py +28 -0
- magic_hour/types/params/{post_v1_ai_image_generator_body.py → v1_ai_image_generator_create_body.py} +17 -11
- magic_hour/types/params/v1_ai_image_generator_create_body_style.py +127 -0
- magic_hour/types/params/v1_ai_image_upscaler_create_body.py +59 -0
- magic_hour/types/params/v1_ai_image_upscaler_create_body_assets.py +33 -0
- magic_hour/types/params/{post_v1_ai_image_upscaler_body_style.py → v1_ai_image_upscaler_create_body_style.py} +4 -4
- magic_hour/types/params/v1_ai_image_upscaler_generate_body_assets.py +17 -0
- magic_hour/types/params/v1_ai_meme_generator_create_body.py +37 -0
- magic_hour/types/params/v1_ai_meme_generator_create_body_style.py +73 -0
- magic_hour/types/params/{post_v1_ai_photo_editor_body.py → v1_ai_photo_editor_create_body.py} +15 -15
- magic_hour/types/params/v1_ai_photo_editor_create_body_assets.py +33 -0
- magic_hour/types/params/{post_v1_ai_photo_editor_body_style.py → v1_ai_photo_editor_create_body_style.py} +20 -4
- magic_hour/types/params/v1_ai_photo_editor_generate_body_assets.py +17 -0
- magic_hour/types/params/v1_ai_qr_code_generator_create_body.py +45 -0
- magic_hour/types/params/{post_v1_ai_qr_code_generator_body_style.py → v1_ai_qr_code_generator_create_body_style.py} +4 -4
- magic_hour/types/params/v1_ai_talking_photo_create_body.py +68 -0
- magic_hour/types/params/v1_ai_talking_photo_create_body_assets.py +46 -0
- magic_hour/types/params/v1_ai_talking_photo_create_body_style.py +44 -0
- magic_hour/types/params/v1_ai_talking_photo_generate_body_assets.py +26 -0
- 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.py +40 -0
- magic_hour/types/params/v1_ai_voice_generator_create_body_style.py +440 -0
- magic_hour/types/params/{post_v1_animation_body.py → v1_animation_create_body.py} +16 -16
- magic_hour/types/params/{post_v1_animation_body_assets.py → v1_animation_create_body_assets.py} +15 -5
- magic_hour/types/params/{post_v1_animation_body_style.py → v1_animation_create_body_style.py} +13 -10
- magic_hour/types/params/v1_animation_generate_body_assets.py +39 -0
- magic_hour/types/params/v1_auto_subtitle_generator_create_body.py +78 -0
- magic_hour/types/params/v1_auto_subtitle_generator_create_body_assets.py +33 -0
- magic_hour/types/params/v1_auto_subtitle_generator_create_body_style.py +56 -0
- magic_hour/types/params/v1_auto_subtitle_generator_create_body_style_custom_config.py +86 -0
- magic_hour/types/params/v1_auto_subtitle_generator_generate_body_assets.py +17 -0
- magic_hour/types/params/v1_face_detection_create_body.py +44 -0
- magic_hour/types/params/v1_face_detection_create_body_assets.py +33 -0
- magic_hour/types/params/v1_face_detection_generate_body_assets.py +17 -0
- magic_hour/types/params/v1_face_swap_create_body.py +92 -0
- magic_hour/types/params/v1_face_swap_create_body_assets.py +91 -0
- magic_hour/types/params/v1_face_swap_create_body_assets_face_mappings_item.py +44 -0
- magic_hour/types/params/v1_face_swap_create_body_style.py +33 -0
- magic_hour/types/params/v1_face_swap_generate_body_assets.py +56 -0
- magic_hour/types/params/v1_face_swap_generate_body_assets_face_mappings_item.py +25 -0
- magic_hour/types/params/v1_face_swap_photo_create_body.py +40 -0
- magic_hour/types/params/v1_face_swap_photo_create_body_assets.py +76 -0
- magic_hour/types/params/v1_face_swap_photo_create_body_assets_face_mappings_item.py +44 -0
- magic_hour/types/params/v1_face_swap_photo_generate_body_assets.py +47 -0
- magic_hour/types/params/v1_face_swap_photo_generate_body_assets_face_mappings_item.py +25 -0
- magic_hour/types/params/v1_files_upload_urls_create_body.py +36 -0
- magic_hour/types/params/v1_files_upload_urls_create_body_items_item.py +38 -0
- magic_hour/types/params/v1_image_background_remover_create_body.py +40 -0
- magic_hour/types/params/v1_image_background_remover_create_body_assets.py +49 -0
- magic_hour/types/params/v1_image_background_remover_generate_body_assets.py +27 -0
- magic_hour/types/params/v1_image_to_video_create_body.py +101 -0
- magic_hour/types/params/v1_image_to_video_create_body_assets.py +33 -0
- magic_hour/types/params/v1_image_to_video_create_body_style.py +53 -0
- magic_hour/types/params/v1_image_to_video_generate_body_assets.py +17 -0
- magic_hour/types/params/v1_lip_sync_create_body.py +100 -0
- magic_hour/types/params/{post_v1_lip_sync_body_assets.py → v1_lip_sync_create_body_assets.py} +15 -5
- magic_hour/types/params/v1_lip_sync_create_body_style.py +37 -0
- magic_hour/types/params/v1_lip_sync_generate_body_assets.py +36 -0
- magic_hour/types/params/v1_photo_colorizer_create_body.py +40 -0
- magic_hour/types/params/v1_photo_colorizer_create_body_assets.py +33 -0
- magic_hour/types/params/v1_photo_colorizer_generate_body_assets.py +17 -0
- magic_hour/types/params/v1_text_to_video_create_body.py +78 -0
- magic_hour/types/params/v1_text_to_video_create_body_style.py +43 -0
- magic_hour/types/params/v1_video_to_video_create_body.py +101 -0
- magic_hour/types/params/{post_v1_video_to_video_body_assets.py → v1_video_to_video_create_body_assets.py} +9 -4
- magic_hour/types/params/{post_v1_video_to_video_body_style.py → v1_video_to_video_create_body_style.py} +68 -26
- magic_hour/types/params/v1_video_to_video_generate_body_assets.py +27 -0
- magic_hour-0.44.0.dist-info/METADATA +328 -0
- magic_hour-0.44.0.dist-info/RECORD +231 -0
- magic_hour/core/__init__.py +0 -52
- magic_hour/core/api_error.py +0 -56
- magic_hour/core/auth.py +0 -314
- magic_hour/core/base_client.py +0 -618
- magic_hour/core/binary_response.py +0 -23
- magic_hour/core/query.py +0 -106
- magic_hour/core/request.py +0 -156
- magic_hour/core/response.py +0 -293
- magic_hour/core/type_utils.py +0 -28
- magic_hour/core/utils.py +0 -55
- magic_hour/types/models/post_v1_ai_clothes_changer_response.py +0 -25
- magic_hour/types/models/post_v1_ai_headshot_generator_response.py +0 -25
- magic_hour/types/models/post_v1_ai_image_generator_response.py +0 -25
- magic_hour/types/models/post_v1_ai_image_upscaler_response.py +0 -25
- magic_hour/types/models/post_v1_ai_photo_editor_response.py +0 -25
- magic_hour/types/models/post_v1_ai_qr_code_generator_response.py +0 -25
- magic_hour/types/models/post_v1_animation_response.py +0 -25
- magic_hour/types/models/post_v1_face_swap_photo_response.py +0 -25
- magic_hour/types/models/post_v1_face_swap_response.py +0 -25
- magic_hour/types/models/post_v1_files_upload_urls_response.py +0 -21
- magic_hour/types/models/post_v1_image_background_remover_response.py +0 -25
- magic_hour/types/models/post_v1_image_to_video_response.py +0 -25
- magic_hour/types/models/post_v1_lip_sync_response.py +0 -25
- magic_hour/types/models/post_v1_text_to_video_response.py +0 -25
- magic_hour/types/models/post_v1_video_to_video_response.py +0 -25
- magic_hour/types/params/post_v1_ai_clothes_changer_body.py +0 -40
- magic_hour/types/params/post_v1_ai_clothes_changer_body_assets.py +0 -45
- magic_hour/types/params/post_v1_ai_headshot_generator_body.py +0 -40
- magic_hour/types/params/post_v1_ai_headshot_generator_body_assets.py +0 -28
- magic_hour/types/params/post_v1_ai_image_upscaler_body.py +0 -57
- magic_hour/types/params/post_v1_ai_image_upscaler_body_assets.py +0 -28
- magic_hour/types/params/post_v1_ai_photo_editor_body_assets.py +0 -28
- magic_hour/types/params/post_v1_ai_qr_code_generator_body.py +0 -45
- magic_hour/types/params/post_v1_face_swap_body.py +0 -72
- magic_hour/types/params/post_v1_face_swap_body_assets.py +0 -52
- magic_hour/types/params/post_v1_face_swap_photo_body.py +0 -40
- magic_hour/types/params/post_v1_face_swap_photo_body_assets.py +0 -36
- magic_hour/types/params/post_v1_files_upload_urls_body.py +0 -31
- magic_hour/types/params/post_v1_files_upload_urls_body_items_item.py +0 -38
- magic_hour/types/params/post_v1_image_background_remover_body.py +0 -40
- magic_hour/types/params/post_v1_image_background_remover_body_assets.py +0 -28
- magic_hour/types/params/post_v1_image_to_video_body.py +0 -73
- magic_hour/types/params/post_v1_image_to_video_body_assets.py +0 -28
- magic_hour/types/params/post_v1_image_to_video_body_style.py +0 -37
- magic_hour/types/params/post_v1_lip_sync_body.py +0 -80
- magic_hour/types/params/post_v1_text_to_video_body.py +0 -57
- magic_hour/types/params/post_v1_text_to_video_body_style.py +0 -28
- magic_hour/types/params/post_v1_video_to_video_body.py +0 -93
- magic_hour-0.9.5.dist-info/METADATA +0 -133
- magic_hour-0.9.5.dist-info/RECORD +0 -132
- {magic_hour-0.9.5.dist-info → magic_hour-0.44.0.dist-info}/LICENSE +0 -0
- {magic_hour-0.9.5.dist-info → magic_hour-0.44.0.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# v1.ai_meme_generator
|
|
2
|
+
|
|
3
|
+
## Module Functions
|
|
4
|
+
|
|
5
|
+
<!-- CUSTOM DOCS START -->
|
|
6
|
+
|
|
7
|
+
### Ai Meme Generator Generate Workflow <a name="generate"></a>
|
|
8
|
+
|
|
9
|
+
The workflow performs the following action
|
|
10
|
+
|
|
11
|
+
1. upload local assets to Magic Hour storage. So you can pass in a local path instead of having to upload files yourself
|
|
12
|
+
2. trigger a generation
|
|
13
|
+
3. poll for a completion status. This is configurable
|
|
14
|
+
4. if success, download the output to local directory
|
|
15
|
+
|
|
16
|
+
> [!TIP]
|
|
17
|
+
> This is the recommended way to use the SDK unless you have specific needs where it is necessary to split up the actions.
|
|
18
|
+
|
|
19
|
+
#### Parameters
|
|
20
|
+
|
|
21
|
+
In Additional to the parameters listed in the `.create` section below, `.generate` introduces 3 new parameters:
|
|
22
|
+
|
|
23
|
+
- `wait_for_completion` (bool, default True): Whether to wait for the project to complete.
|
|
24
|
+
- `download_outputs` (bool, default True): Whether to download the generated files
|
|
25
|
+
- `download_directory` (str, optional): Directory to save downloaded files (defaults to current directory)
|
|
26
|
+
|
|
27
|
+
#### Synchronous Client
|
|
28
|
+
|
|
29
|
+
```python
|
|
30
|
+
from magic_hour import Client
|
|
31
|
+
from os import getenv
|
|
32
|
+
|
|
33
|
+
client = Client(token=getenv("API_TOKEN"))
|
|
34
|
+
res = client.v1.ai_meme_generator.generate(
|
|
35
|
+
style={
|
|
36
|
+
"search_web": False,
|
|
37
|
+
"template": "Drake Hotline Bling",
|
|
38
|
+
"topic": "When the code finally works",
|
|
39
|
+
},
|
|
40
|
+
name="My Funny Meme",
|
|
41
|
+
wait_for_completion=True,
|
|
42
|
+
download_outputs=True,
|
|
43
|
+
download_directory="outputs"
|
|
44
|
+
)
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
#### Asynchronous Client
|
|
48
|
+
|
|
49
|
+
```python
|
|
50
|
+
from magic_hour import AsyncClient
|
|
51
|
+
from os import getenv
|
|
52
|
+
|
|
53
|
+
client = AsyncClient(token=getenv("API_TOKEN"))
|
|
54
|
+
res = await client.v1.ai_meme_generator.generate(
|
|
55
|
+
style={
|
|
56
|
+
"search_web": False,
|
|
57
|
+
"template": "Drake Hotline Bling",
|
|
58
|
+
"topic": "When the code finally works",
|
|
59
|
+
},
|
|
60
|
+
name="My Funny Meme",
|
|
61
|
+
wait_for_completion=True,
|
|
62
|
+
download_outputs=True,
|
|
63
|
+
download_directory="outputs"
|
|
64
|
+
)
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
<!-- CUSTOM DOCS END -->
|
|
68
|
+
|
|
69
|
+
### AI Meme Generator <a name="create"></a>
|
|
70
|
+
|
|
71
|
+
Create an AI generated meme. Each meme costs 10 credits.
|
|
72
|
+
|
|
73
|
+
**API Endpoint**: `POST /v1/ai-meme-generator`
|
|
74
|
+
|
|
75
|
+
#### Parameters
|
|
76
|
+
|
|
77
|
+
| Parameter | Required | Description | Example |
|
|
78
|
+
| --------------- | :------: | ----------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
|
|
79
|
+
| `style` | ✓ | | `{"search_web": False, "template": "Drake Hotline Bling", "topic": "When the code finally works"}` |
|
|
80
|
+
| `└─ search_web` | ✗ | Whether to search the web for meme content. | `False` |
|
|
81
|
+
| `└─ template` | ✓ | To use our templates, pass in one of the enum values. | `"Drake Hotline Bling"` |
|
|
82
|
+
| `└─ topic` | ✓ | The topic of the meme. | `"When the code finally works"` |
|
|
83
|
+
| `name` | ✗ | The name of the meme. | `"My Funny Meme"` |
|
|
84
|
+
|
|
85
|
+
#### Synchronous Client
|
|
86
|
+
|
|
87
|
+
```python
|
|
88
|
+
from magic_hour import Client
|
|
89
|
+
from os import getenv
|
|
90
|
+
|
|
91
|
+
client = Client(token=getenv("API_TOKEN"))
|
|
92
|
+
res = client.v1.ai_meme_generator.create(
|
|
93
|
+
style={
|
|
94
|
+
"search_web": False,
|
|
95
|
+
"template": "Drake Hotline Bling",
|
|
96
|
+
"topic": "When the code finally works",
|
|
97
|
+
},
|
|
98
|
+
name="My Funny Meme",
|
|
99
|
+
)
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
#### Asynchronous Client
|
|
103
|
+
|
|
104
|
+
```python
|
|
105
|
+
from magic_hour import AsyncClient
|
|
106
|
+
from os import getenv
|
|
107
|
+
|
|
108
|
+
client = AsyncClient(token=getenv("API_TOKEN"))
|
|
109
|
+
res = await client.v1.ai_meme_generator.create(
|
|
110
|
+
style={
|
|
111
|
+
"search_web": False,
|
|
112
|
+
"template": "Drake Hotline Bling",
|
|
113
|
+
"topic": "When the code finally works",
|
|
114
|
+
},
|
|
115
|
+
name="My Funny Meme",
|
|
116
|
+
)
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
#### Response
|
|
120
|
+
|
|
121
|
+
##### Type
|
|
122
|
+
|
|
123
|
+
[V1AiMemeGeneratorCreateResponse](/magic_hour/types/models/v1_ai_meme_generator_create_response.py)
|
|
124
|
+
|
|
125
|
+
##### Example
|
|
126
|
+
|
|
127
|
+
```python
|
|
128
|
+
{"credits_charged": 10, "frame_cost": 10, "id": "cuid-example"}
|
|
129
|
+
```
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import typing
|
|
2
|
+
|
|
3
|
+
from magic_hour.helpers.logger import get_sdk_logger
|
|
4
|
+
from magic_hour.resources.v1.image_projects.client import (
|
|
5
|
+
AsyncImageProjectsClient,
|
|
6
|
+
ImageProjectsClient,
|
|
7
|
+
)
|
|
8
|
+
from magic_hour.types import models, params
|
|
9
|
+
from make_api_request import (
|
|
10
|
+
AsyncBaseClient,
|
|
11
|
+
RequestOptions,
|
|
12
|
+
SyncBaseClient,
|
|
13
|
+
default_request_options,
|
|
14
|
+
to_encodable,
|
|
15
|
+
type_utils,
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
logger = get_sdk_logger(__name__)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class AiMemeGeneratorClient:
|
|
23
|
+
def __init__(self, *, base_client: SyncBaseClient):
|
|
24
|
+
self._base_client = base_client
|
|
25
|
+
|
|
26
|
+
def generate(
|
|
27
|
+
self,
|
|
28
|
+
*,
|
|
29
|
+
style: params.V1AiMemeGeneratorCreateBodyStyle,
|
|
30
|
+
name: typing.Union[
|
|
31
|
+
typing.Optional[str], type_utils.NotGiven
|
|
32
|
+
] = type_utils.NOT_GIVEN,
|
|
33
|
+
wait_for_completion: bool = True,
|
|
34
|
+
download_outputs: bool = True,
|
|
35
|
+
download_directory: typing.Optional[str] = None,
|
|
36
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
37
|
+
):
|
|
38
|
+
"""
|
|
39
|
+
Generate meme (alias for create with additional functionality).
|
|
40
|
+
|
|
41
|
+
Create an AI meme. Each meme costs 5 credits.
|
|
42
|
+
|
|
43
|
+
Args:
|
|
44
|
+
name: The name of image. This value is mainly used for your own identification of the image.
|
|
45
|
+
style: The art style to use for meme generation
|
|
46
|
+
wait_for_completion: Whether to wait for the image project to complete
|
|
47
|
+
download_outputs: Whether to download the outputs
|
|
48
|
+
download_directory: The directory to download the outputs to. If not provided, the outputs will be downloaded to the current working directory
|
|
49
|
+
request_options: Additional options to customize the HTTP request
|
|
50
|
+
|
|
51
|
+
Returns:
|
|
52
|
+
V1ImageProjectsGetResponseWithDownloads: The response from the AI Meme Generator API with the downloaded paths if `download_outputs` is True.
|
|
53
|
+
|
|
54
|
+
Examples:
|
|
55
|
+
```py
|
|
56
|
+
response = client.v1.ai_meme_generator.generate(
|
|
57
|
+
style={
|
|
58
|
+
"search_web": False,
|
|
59
|
+
"template": "Drake Hotline Bling",
|
|
60
|
+
"topic": "When the code finally works",
|
|
61
|
+
},
|
|
62
|
+
name="Funny Programming Meme",
|
|
63
|
+
wait_for_completion=True,
|
|
64
|
+
download_outputs=True,
|
|
65
|
+
download_directory="outputs/",
|
|
66
|
+
)
|
|
67
|
+
```
|
|
68
|
+
"""
|
|
69
|
+
|
|
70
|
+
create_response = self.create(
|
|
71
|
+
style=style, name=name, request_options=request_options
|
|
72
|
+
)
|
|
73
|
+
logger.info(f"AI Meme Generator response: {create_response}")
|
|
74
|
+
|
|
75
|
+
image_projects_client = ImageProjectsClient(base_client=self._base_client)
|
|
76
|
+
response = image_projects_client.check_result(
|
|
77
|
+
id=create_response.id,
|
|
78
|
+
wait_for_completion=wait_for_completion,
|
|
79
|
+
download_outputs=download_outputs,
|
|
80
|
+
download_directory=download_directory,
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
return response
|
|
84
|
+
|
|
85
|
+
def create(
|
|
86
|
+
self,
|
|
87
|
+
*,
|
|
88
|
+
style: params.V1AiMemeGeneratorCreateBodyStyle,
|
|
89
|
+
name: typing.Union[
|
|
90
|
+
typing.Optional[str], type_utils.NotGiven
|
|
91
|
+
] = type_utils.NOT_GIVEN,
|
|
92
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
93
|
+
) -> models.V1AiMemeGeneratorCreateResponse:
|
|
94
|
+
"""
|
|
95
|
+
AI Meme Generator
|
|
96
|
+
|
|
97
|
+
Create an AI generated meme. Each meme costs 10 credits.
|
|
98
|
+
|
|
99
|
+
POST /v1/ai-meme-generator
|
|
100
|
+
|
|
101
|
+
Args:
|
|
102
|
+
name: The name of the meme.
|
|
103
|
+
style: V1AiMemeGeneratorCreateBodyStyle
|
|
104
|
+
request_options: Additional options to customize the HTTP request
|
|
105
|
+
|
|
106
|
+
Returns:
|
|
107
|
+
Success
|
|
108
|
+
|
|
109
|
+
Raises:
|
|
110
|
+
ApiError: A custom exception class that provides additional context
|
|
111
|
+
for API errors, including the HTTP status code and response body.
|
|
112
|
+
|
|
113
|
+
Examples:
|
|
114
|
+
```py
|
|
115
|
+
client.v1.ai_meme_generator.create(
|
|
116
|
+
style={
|
|
117
|
+
"search_web": False,
|
|
118
|
+
"template": "Drake Hotline Bling",
|
|
119
|
+
"topic": "When the code finally works",
|
|
120
|
+
},
|
|
121
|
+
name="My Funny Meme",
|
|
122
|
+
)
|
|
123
|
+
```
|
|
124
|
+
"""
|
|
125
|
+
_json = to_encodable(
|
|
126
|
+
item={"name": name, "style": style},
|
|
127
|
+
dump_with=params._SerializerV1AiMemeGeneratorCreateBody,
|
|
128
|
+
)
|
|
129
|
+
return self._base_client.request(
|
|
130
|
+
method="POST",
|
|
131
|
+
path="/v1/ai-meme-generator",
|
|
132
|
+
auth_names=["bearerAuth"],
|
|
133
|
+
json=_json,
|
|
134
|
+
cast_to=models.V1AiMemeGeneratorCreateResponse,
|
|
135
|
+
request_options=request_options or default_request_options(),
|
|
136
|
+
)
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
class AsyncAiMemeGeneratorClient:
|
|
140
|
+
def __init__(self, *, base_client: AsyncBaseClient):
|
|
141
|
+
self._base_client = base_client
|
|
142
|
+
|
|
143
|
+
async def generate(
|
|
144
|
+
self,
|
|
145
|
+
*,
|
|
146
|
+
style: params.V1AiMemeGeneratorCreateBodyStyle,
|
|
147
|
+
name: typing.Union[
|
|
148
|
+
typing.Optional[str], type_utils.NotGiven
|
|
149
|
+
] = type_utils.NOT_GIVEN,
|
|
150
|
+
wait_for_completion: bool = True,
|
|
151
|
+
download_outputs: bool = True,
|
|
152
|
+
download_directory: typing.Optional[str] = None,
|
|
153
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
154
|
+
):
|
|
155
|
+
"""
|
|
156
|
+
Generate meme (alias for create with additional functionality).
|
|
157
|
+
|
|
158
|
+
Create an AI meme. Each meme costs 5 credits.
|
|
159
|
+
|
|
160
|
+
Args:
|
|
161
|
+
name: The name of image. This value is mainly used for your own identification of the image.
|
|
162
|
+
style: The art style to use for meme generation
|
|
163
|
+
wait_for_completion: Whether to wait for the image project to complete
|
|
164
|
+
download_outputs: Whether to download the outputs
|
|
165
|
+
download_directory: The directory to download the outputs to. If not provided, the outputs will be downloaded to the current working directory
|
|
166
|
+
request_options: Additional options to customize the HTTP request
|
|
167
|
+
|
|
168
|
+
Returns:
|
|
169
|
+
V1ImageProjectsGetResponseWithDownloads: The response from the AI Meme Generator API with the downloaded paths if `download_outputs` is True.
|
|
170
|
+
|
|
171
|
+
Examples:
|
|
172
|
+
```py
|
|
173
|
+
response = await client.v1.ai_meme_generator.generate(
|
|
174
|
+
style={
|
|
175
|
+
"search_web": False,
|
|
176
|
+
"template": "Drake Hotline Bling",
|
|
177
|
+
"topic": "When the code finally works",
|
|
178
|
+
},
|
|
179
|
+
name="Funny Programming Meme",
|
|
180
|
+
wait_for_completion=True,
|
|
181
|
+
download_outputs=True,
|
|
182
|
+
download_directory="outputs/",
|
|
183
|
+
)
|
|
184
|
+
```
|
|
185
|
+
"""
|
|
186
|
+
|
|
187
|
+
create_response = await self.create(
|
|
188
|
+
style=style, name=name, request_options=request_options
|
|
189
|
+
)
|
|
190
|
+
logger.info(f"AI Meme Generator response: {create_response}")
|
|
191
|
+
|
|
192
|
+
image_projects_client = AsyncImageProjectsClient(base_client=self._base_client)
|
|
193
|
+
response = await image_projects_client.check_result(
|
|
194
|
+
id=create_response.id,
|
|
195
|
+
wait_for_completion=wait_for_completion,
|
|
196
|
+
download_outputs=download_outputs,
|
|
197
|
+
download_directory=download_directory,
|
|
198
|
+
)
|
|
199
|
+
|
|
200
|
+
return response
|
|
201
|
+
|
|
202
|
+
async def create(
|
|
203
|
+
self,
|
|
204
|
+
*,
|
|
205
|
+
style: params.V1AiMemeGeneratorCreateBodyStyle,
|
|
206
|
+
name: typing.Union[
|
|
207
|
+
typing.Optional[str], type_utils.NotGiven
|
|
208
|
+
] = type_utils.NOT_GIVEN,
|
|
209
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
210
|
+
) -> models.V1AiMemeGeneratorCreateResponse:
|
|
211
|
+
"""
|
|
212
|
+
AI Meme Generator
|
|
213
|
+
|
|
214
|
+
Create an AI generated meme. Each meme costs 10 credits.
|
|
215
|
+
|
|
216
|
+
POST /v1/ai-meme-generator
|
|
217
|
+
|
|
218
|
+
Args:
|
|
219
|
+
name: The name of the meme.
|
|
220
|
+
style: V1AiMemeGeneratorCreateBodyStyle
|
|
221
|
+
request_options: Additional options to customize the HTTP request
|
|
222
|
+
|
|
223
|
+
Returns:
|
|
224
|
+
Success
|
|
225
|
+
|
|
226
|
+
Raises:
|
|
227
|
+
ApiError: A custom exception class that provides additional context
|
|
228
|
+
for API errors, including the HTTP status code and response body.
|
|
229
|
+
|
|
230
|
+
Examples:
|
|
231
|
+
```py
|
|
232
|
+
await client.v1.ai_meme_generator.create(
|
|
233
|
+
style={
|
|
234
|
+
"search_web": False,
|
|
235
|
+
"template": "Drake Hotline Bling",
|
|
236
|
+
"topic": "When the code finally works",
|
|
237
|
+
},
|
|
238
|
+
name="My Funny Meme",
|
|
239
|
+
)
|
|
240
|
+
```
|
|
241
|
+
"""
|
|
242
|
+
_json = to_encodable(
|
|
243
|
+
item={"name": name, "style": style},
|
|
244
|
+
dump_with=params._SerializerV1AiMemeGeneratorCreateBody,
|
|
245
|
+
)
|
|
246
|
+
return await self._base_client.request(
|
|
247
|
+
method="POST",
|
|
248
|
+
path="/v1/ai-meme-generator",
|
|
249
|
+
auth_names=["bearerAuth"],
|
|
250
|
+
json=_json,
|
|
251
|
+
cast_to=models.V1AiMemeGeneratorCreateResponse,
|
|
252
|
+
request_options=request_options or default_request_options(),
|
|
253
|
+
)
|
|
@@ -1,13 +1,112 @@
|
|
|
1
|
+
# v1.ai_photo_editor
|
|
1
2
|
|
|
2
|
-
|
|
3
|
-
AI Photo Editor
|
|
3
|
+
## Module Functions
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
<!-- CUSTOM DOCS START -->
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
### Ai Photo Editor Generate Workflow <a name="generate"></a>
|
|
8
|
+
|
|
9
|
+
The workflow performs the following action
|
|
10
|
+
|
|
11
|
+
1. upload local assets to Magic Hour storage. So you can pass in a local path instead of having to upload files yourself
|
|
12
|
+
2. trigger a generation
|
|
13
|
+
3. poll for a completion status. This is configurable
|
|
14
|
+
4. if success, download the output to local directory
|
|
15
|
+
|
|
16
|
+
> [!TIP]
|
|
17
|
+
> This is the recommended way to use the SDK unless you have specific needs where it is necessary to split up the actions.
|
|
18
|
+
|
|
19
|
+
#### Parameters
|
|
20
|
+
|
|
21
|
+
In Additional to the parameters listed in the `.create` section below, `.generate` introduces 3 new parameters:
|
|
22
|
+
|
|
23
|
+
- `wait_for_completion` (bool, default True): Whether to wait for the project to complete.
|
|
24
|
+
- `download_outputs` (bool, default True): Whether to download the generated files
|
|
25
|
+
- `download_directory` (str, optional): Directory to save downloaded files (defaults to current directory)
|
|
26
|
+
|
|
27
|
+
#### Synchronous Client
|
|
28
|
+
|
|
29
|
+
```python
|
|
30
|
+
from magic_hour import Client
|
|
31
|
+
from os import getenv
|
|
32
|
+
|
|
33
|
+
client = Client(token=getenv("API_TOKEN"))
|
|
34
|
+
res = client.v1.ai_photo_editor.generate(
|
|
35
|
+
assets={"image_file_path": "/path/to/1234.png"},
|
|
36
|
+
resolution=768,
|
|
37
|
+
style={
|
|
38
|
+
"image_description": "A photo of a person",
|
|
39
|
+
"likeness_strength": 5.2,
|
|
40
|
+
"negative_prompt": "painting, cartoon, sketch",
|
|
41
|
+
"prompt": "A photo portrait of a person wearing a hat",
|
|
42
|
+
"prompt_strength": 3.75,
|
|
43
|
+
"steps": 4,
|
|
44
|
+
"upscale_factor": 2,
|
|
45
|
+
"upscale_fidelity": 0.5,
|
|
46
|
+
},
|
|
47
|
+
name="Photo Editor image",
|
|
48
|
+
wait_for_completion=True,
|
|
49
|
+
download_outputs=True,
|
|
50
|
+
download_directory="outputs"
|
|
51
|
+
)
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
#### Asynchronous Client
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
from magic_hour import AsyncClient
|
|
58
|
+
from os import getenv
|
|
59
|
+
|
|
60
|
+
client = AsyncClient(token=getenv("API_TOKEN"))
|
|
61
|
+
res = await client.v1.ai_photo_editor.generate(
|
|
62
|
+
assets={"image_file_path": "/path/to/1234.png"},
|
|
63
|
+
resolution=768,
|
|
64
|
+
style={
|
|
65
|
+
"image_description": "A photo of a person",
|
|
66
|
+
"likeness_strength": 5.2,
|
|
67
|
+
"negative_prompt": "painting, cartoon, sketch",
|
|
68
|
+
"prompt": "A photo portrait of a person wearing a hat",
|
|
69
|
+
"prompt_strength": 3.75,
|
|
70
|
+
"steps": 4,
|
|
71
|
+
"upscale_factor": 2,
|
|
72
|
+
"upscale_fidelity": 0.5,
|
|
73
|
+
},
|
|
74
|
+
name="Photo Editor image",
|
|
75
|
+
wait_for_completion=True,
|
|
76
|
+
download_outputs=True,
|
|
77
|
+
download_directory="outputs"
|
|
78
|
+
)
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
<!-- CUSTOM DOCS END -->
|
|
82
|
+
|
|
83
|
+
### AI Photo Editor <a name="create"></a>
|
|
84
|
+
|
|
85
|
+
> **NOTE**: this API is still in early development stages, and should be avoided. Please reach out to us if you're interested in this API.
|
|
86
|
+
|
|
87
|
+
Edit photo using AI. Each photo costs 10 credits.
|
|
8
88
|
|
|
9
89
|
**API Endpoint**: `POST /v1/ai-photo-editor`
|
|
10
90
|
|
|
91
|
+
#### Parameters
|
|
92
|
+
|
|
93
|
+
| Parameter | Required | Deprecated | Description | Example |
|
|
94
|
+
| ---------------------- | :------: | :--------: | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
95
|
+
| `assets` | ✓ | ✗ | Provide the assets for photo editor | `{"image_file_path": "api-assets/id/1234.png"}` |
|
|
96
|
+
| `└─ image_file_path` | ✓ | — | The image used to generate the output. 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"` |
|
|
97
|
+
| `resolution` | ✓ | ✗ | The resolution of the final output image. The allowed value is based on your subscription. Please refer to our [pricing page](https://magichour.ai/pricing) for more details | `768` |
|
|
98
|
+
| `style` | ✓ | ✗ | | `{"image_description": "A photo of a person", "likeness_strength": 5.2, "negative_prompt": "painting, cartoon, sketch", "prompt": "A photo portrait of a person wearing a hat", "prompt_strength": 3.75, "steps": 4, "upscale_factor": 2, "upscale_fidelity": 0.5}` |
|
|
99
|
+
| `└─ image_description` | ✓ | — | Use this to describe what your input image is. This helps maintain aspects of the image you don't want to change. | `"A photo of a person"` |
|
|
100
|
+
| `└─ likeness_strength` | ✓ | — | Determines the input image's influence. Higher values align the output more with the initial image. | `5.2` |
|
|
101
|
+
| `└─ negative_prompt` | ✗ | — | What you want to avoid seeing in the final output; has a minor effect. | `"painting, cartoon, sketch"` |
|
|
102
|
+
| `└─ prompt` | ✓ | — | What you want your final output to look like. We recommend starting with the image description and making minor edits for best results. | `"A photo portrait of a person wearing a hat"` |
|
|
103
|
+
| `└─ prompt_strength` | ✓ | — | Determines the prompt's influence. Higher values align the output more with the prompt. | `3.75` |
|
|
104
|
+
| `└─ steps` | ✗ | — | Number of iterations used to generate the output. Higher values improve quality and increase the strength of the prompt but increase processing time. | `4` |
|
|
105
|
+
| `└─ upscale_factor` | ✗ | — | The multiplier applied to an image's original dimensions during the upscaling process. For example, a scale of 2 doubles the width and height (e.g., from 512x512 to 1024x1024). | `2` |
|
|
106
|
+
| `└─ upscale_fidelity` | ✗ | — | Upscale fidelity refers to the level of quality desired in the generated image. Fidelity value of 1 means more details. | `0.5` |
|
|
107
|
+
| `name` | ✗ | ✗ | The name of image. This value is mainly used for your own identification of the image. | `"Photo Editor image"` |
|
|
108
|
+
| `steps` | ✗ | ✓ | Deprecated: Please use `.style.steps` instead. Number of iterations used to generate the output. Higher values improve quality and increase the strength of the prompt but increase processing time. | `123` |
|
|
109
|
+
|
|
11
110
|
#### Synchronous Client
|
|
12
111
|
|
|
13
112
|
```python
|
|
@@ -25,6 +124,8 @@ res = client.v1.ai_photo_editor.create(
|
|
|
25
124
|
"prompt": "A photo portrait of a person wearing a hat",
|
|
26
125
|
"prompt_strength": 3.75,
|
|
27
126
|
"steps": 4,
|
|
127
|
+
"upscale_factor": 2,
|
|
128
|
+
"upscale_fidelity": 0.5,
|
|
28
129
|
},
|
|
29
130
|
name="Photo Editor image",
|
|
30
131
|
)
|
|
@@ -47,7 +148,21 @@ res = await client.v1.ai_photo_editor.create(
|
|
|
47
148
|
"prompt": "A photo portrait of a person wearing a hat",
|
|
48
149
|
"prompt_strength": 3.75,
|
|
49
150
|
"steps": 4,
|
|
151
|
+
"upscale_factor": 2,
|
|
152
|
+
"upscale_fidelity": 0.5,
|
|
50
153
|
},
|
|
51
154
|
name="Photo Editor image",
|
|
52
155
|
)
|
|
53
156
|
```
|
|
157
|
+
|
|
158
|
+
#### Response
|
|
159
|
+
|
|
160
|
+
##### Type
|
|
161
|
+
|
|
162
|
+
[V1AiPhotoEditorCreateResponse](/magic_hour/types/models/v1_ai_photo_editor_create_response.py)
|
|
163
|
+
|
|
164
|
+
##### Example
|
|
165
|
+
|
|
166
|
+
```python
|
|
167
|
+
{"credits_charged": 10, "frame_cost": 10, "id": "cuid-example"}
|
|
168
|
+
```
|