Skip to content

Commit 4374a1e

Browse files
Wauplingithub-actions[bot]
authored andcommitted
Update inference types (automated commit)
1 parent e1b40d5 commit 4374a1e

File tree

6 files changed

+193
-0
lines changed

6 files changed

+193
-0
lines changed

docs/source/en/package_reference/inference_types.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,30 @@ This part of the lib is still under development and will be improved in future r
173173

174174

175175

176+
## image_text_to_image
177+
178+
[[autodoc]] huggingface_hub.ImageTextToImageInput
179+
180+
[[autodoc]] huggingface_hub.ImageTextToImageOutput
181+
182+
[[autodoc]] huggingface_hub.ImageTextToImageParameters
183+
184+
[[autodoc]] huggingface_hub.ImageTextToImageTargetSize
185+
186+
187+
188+
## image_text_to_video
189+
190+
[[autodoc]] huggingface_hub.ImageTextToVideoInput
191+
192+
[[autodoc]] huggingface_hub.ImageTextToVideoOutput
193+
194+
[[autodoc]] huggingface_hub.ImageTextToVideoParameters
195+
196+
[[autodoc]] huggingface_hub.ImageTextToVideoTargetSize
197+
198+
199+
176200
## image_to_image
177201

178202
[[autodoc]] huggingface_hub.ImageToImageInput

docs/source/ko/package_reference/inference_types.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,30 @@ rendered properly in your Markdown viewer.
172172

173173

174174

175+
## image_text_to_image[[huggingface_hub.ImageTextToImageInput]]
176+
177+
[[autodoc]] huggingface_hub.ImageTextToImageInput
178+
179+
[[autodoc]] huggingface_hub.ImageTextToImageOutput
180+
181+
[[autodoc]] huggingface_hub.ImageTextToImageParameters
182+
183+
[[autodoc]] huggingface_hub.ImageTextToImageTargetSize
184+
185+
186+
187+
## image_text_to_video[[huggingface_hub.ImageTextToVideoInput]]
188+
189+
[[autodoc]] huggingface_hub.ImageTextToVideoInput
190+
191+
[[autodoc]] huggingface_hub.ImageTextToVideoOutput
192+
193+
[[autodoc]] huggingface_hub.ImageTextToVideoParameters
194+
195+
[[autodoc]] huggingface_hub.ImageTextToVideoTargetSize
196+
197+
198+
175199
## image_to_image[[huggingface_hub.ImageToImageInput]]
176200

177201
[[autodoc]] huggingface_hub.ImageToImageInput

src/huggingface_hub/inference/_generated/types/__init__.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,18 @@
7777
ImageSegmentationParameters,
7878
ImageSegmentationSubtask,
7979
)
80+
from .image_text_to_image import (
81+
ImageTextToImageInput,
82+
ImageTextToImageOutput,
83+
ImageTextToImageParameters,
84+
ImageTextToImageTargetSize,
85+
)
86+
from .image_text_to_video import (
87+
ImageTextToVideoInput,
88+
ImageTextToVideoOutput,
89+
ImageTextToVideoParameters,
90+
ImageTextToVideoTargetSize,
91+
)
8092
from .image_to_image import ImageToImageInput, ImageToImageOutput, ImageToImageParameters, ImageToImageTargetSize
8193
from .image_to_text import (
8294
ImageToTextEarlyStoppingEnum,
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Inference code generated from the JSON schema spec in @huggingface/tasks.
2+
#
3+
# See:
4+
# - script: https://github.com/huggingface/huggingface.js/blob/main/packages/tasks/scripts/inference-codegen.ts
5+
# - specs: https://github.com/huggingface/huggingface.js/tree/main/packages/tasks/src/tasks.
6+
from typing import Any, Optional
7+
8+
from .base import BaseInferenceType, dataclass_with_extra
9+
10+
11+
@dataclass_with_extra
12+
class ImageTextToImageTargetSize(BaseInferenceType):
13+
"""The size in pixels of the output image. This parameter is only supported by some
14+
providers and for specific models. It will be ignored when unsupported.
15+
"""
16+
17+
height: int
18+
width: int
19+
20+
21+
@dataclass_with_extra
22+
class ImageTextToImageParameters(BaseInferenceType):
23+
"""Additional inference parameters for Image Text To Image"""
24+
25+
guidance_scale: Optional[float] = None
26+
"""For diffusion models. A higher guidance scale value encourages the model to generate
27+
images closely linked to the text prompt at the expense of lower image quality.
28+
"""
29+
negative_prompt: Optional[str] = None
30+
"""One prompt to guide what NOT to include in image generation."""
31+
num_inference_steps: Optional[int] = None
32+
"""For diffusion models. The number of denoising steps. More denoising steps usually lead to
33+
a higher quality image at the expense of slower inference.
34+
"""
35+
prompt: Optional[str] = None
36+
"""The text prompt to guide the image generation. Either this or inputs (image) must be
37+
provided.
38+
"""
39+
seed: Optional[int] = None
40+
"""Seed for the random number generator."""
41+
target_size: Optional[ImageTextToImageTargetSize] = None
42+
"""The size in pixels of the output image. This parameter is only supported by some
43+
providers and for specific models. It will be ignored when unsupported.
44+
"""
45+
46+
47+
@dataclass_with_extra
48+
class ImageTextToImageInput(BaseInferenceType):
49+
"""Inputs for Image Text To Image inference. Either inputs (image) or prompt (in parameters)
50+
must be provided, or both.
51+
"""
52+
53+
inputs: Optional[str] = None
54+
"""The input image data as a base64-encoded string. If no `parameters` are provided, you can
55+
also provide the image data as a raw bytes payload. Either this or prompt must be
56+
provided.
57+
"""
58+
parameters: Optional[ImageTextToImageParameters] = None
59+
"""Additional inference parameters for Image Text To Image"""
60+
61+
62+
@dataclass_with_extra
63+
class ImageTextToImageOutput(BaseInferenceType):
64+
"""Outputs of inference for the Image Text To Image task"""
65+
66+
image: Any
67+
"""The generated image returned as raw bytes in the payload."""
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Inference code generated from the JSON schema spec in @huggingface/tasks.
2+
#
3+
# See:
4+
# - script: https://github.com/huggingface/huggingface.js/blob/main/packages/tasks/scripts/inference-codegen.ts
5+
# - specs: https://github.com/huggingface/huggingface.js/tree/main/packages/tasks/src/tasks.
6+
from typing import Any, Optional
7+
8+
from .base import BaseInferenceType, dataclass_with_extra
9+
10+
11+
@dataclass_with_extra
12+
class ImageTextToVideoTargetSize(BaseInferenceType):
13+
"""The size in pixel of the output video frames."""
14+
15+
height: int
16+
width: int
17+
18+
19+
@dataclass_with_extra
20+
class ImageTextToVideoParameters(BaseInferenceType):
21+
"""Additional inference parameters for Image Text To Video"""
22+
23+
guidance_scale: Optional[float] = None
24+
"""For diffusion models. A higher guidance scale value encourages the model to generate
25+
videos closely linked to the text prompt at the expense of lower image quality.
26+
"""
27+
negative_prompt: Optional[str] = None
28+
"""One prompt to guide what NOT to include in video generation."""
29+
num_frames: Optional[float] = None
30+
"""The num_frames parameter determines how many video frames are generated."""
31+
num_inference_steps: Optional[int] = None
32+
"""The number of denoising steps. More denoising steps usually lead to a higher quality
33+
video at the expense of slower inference.
34+
"""
35+
prompt: Optional[str] = None
36+
"""The text prompt to guide the video generation. Either this or inputs (image) must be
37+
provided.
38+
"""
39+
seed: Optional[int] = None
40+
"""Seed for the random number generator."""
41+
target_size: Optional[ImageTextToVideoTargetSize] = None
42+
"""The size in pixel of the output video frames."""
43+
44+
45+
@dataclass_with_extra
46+
class ImageTextToVideoInput(BaseInferenceType):
47+
"""Inputs for Image Text To Video inference. Either inputs (image) or prompt (in parameters)
48+
must be provided, or both.
49+
"""
50+
51+
inputs: Optional[str] = None
52+
"""The input image data as a base64-encoded string. If no `parameters` are provided, you can
53+
also provide the image data as a raw bytes payload. Either this or prompt must be
54+
provided.
55+
"""
56+
parameters: Optional[ImageTextToVideoParameters] = None
57+
"""Additional inference parameters for Image Text To Video"""
58+
59+
60+
@dataclass_with_extra
61+
class ImageTextToVideoOutput(BaseInferenceType):
62+
"""Outputs of inference for the Image Text To Video task"""
63+
64+
video: Any
65+
"""The generated video returned as raw bytes in the payload."""

src/huggingface_hub/inference/_generated/types/zero_shot_object_detection.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# See:
44
# - script: https://github.com/huggingface/huggingface.js/blob/main/packages/tasks/scripts/inference-codegen.ts
55
# - specs: https://github.com/huggingface/huggingface.js/tree/main/packages/tasks/src/tasks.
6+
67
from .base import BaseInferenceType, dataclass_with_extra
78

89

0 commit comments

Comments
 (0)