
    +j:#                       S SK Jr  S SKJr  S SKJrJr  S SKrS SKJ	r	J
r
Jr   " S S5      r " S S	5      r " S
 S5      r " S S5      r " S S5      rS=S jr " S S\\5      r " S S\\5      r " S S\\5      r " S S\\5      r " S S\\5      r " S S\\5      r " S S\\5      r " S S \	5      r " S! S"\	5      r " S# S$\	5      r " S% S&\	5      r " S' S(\	5      r " S) S*\	5      r " S+ S,\	5      r  " S- S.\	5      r! " S/ S0\	5      r" " S1 S2\	5      r# " S3 S4\	5      r$ " S5 S6\	5      r% " S7 S8\	5      r& " S9 S:\	5      r' " S; S<\	5      r(g)>    )annotations)Enum)OptionalUnionN)	BaseModelFieldconfloatc                      \ rS rSrSrSrSrg)LumaIO
   LUMA_REFLUMA_CONCEPTS N)__name__
__module____qualname____firstlineno__r   r   __static_attributes__r       9/home/wildlama/comfy/ComfyUI/comfy_api_nodes/apis/luma.pyr   r   
   s    H#Mr   r   c                  (    \ rS rSrSS jrSS jrSrg)LumaReference   c                    Xl         X l        g Nimageweight)selfr   r   s      r   __init__LumaReference.__init__   s    
r   c                (    [        XR                  S9$ )Nurlr   )LumaImageRefr   )r   download_urls     r   create_api_modelLumaReference.create_api_model   s    [[AAr   r   N)r   ztorch.Tensorr   float)r&   str)r   r   r   r   r    r'   r   r   r   r   r   r      s    Br   r   c                  D    \ rS rSrSS	S jjrSS
S jjrSSS jjrS rSrg)LumaReferenceChain   Nc                X    / U l         U(       a  U R                   R                  U5        g g r   refsappend)r   	first_refs     r   r    LumaReferenceChain.__init__   s#    )+	IIY' r   c                :    U R                   R                  U5        g r   r/   )r   luma_refs     r   addLumaReferenceChain.add   s    		"r   c                    [        U R                  5      S:X  a  g / n[        U R                  U5       H)  u  pE[        XTR                  S9nUR                  U5        M+     U$ )Nr   r#   )lenr0   zipr%   r   r1   )r   download_urlsmax_refsapi_refsrefr$   api_refs          r   r'   #LumaReferenceChain.create_api_model    sR    tyy>Q')DII}5HC"s::>GOOG$ 6 r   c                b    [        5       nU R                   H  nUR                  U5        M     U$ r   )r,   r0   r6   )r   cr>   s      r   cloneLumaReferenceChain.clone)   s(     99CEE#J r   )r0   r   )r2   r   )r5   r   )   )r;   	list[str])	r   r   r   r   r    r6   r'   rC   r   r   r   r   r,   r,      s    (
#r   r,   c                      \ rS rSrSS jrSrg)LumaConcept0   c                    Xl         g r   key)r   rL   s     r   r    LumaConcept.__init__1   s    r   rK   N)rL   r*   )r   r   r   r   r    r   r   r   r   rH   rH   0   s    r   rH   c                  B    \ rS rSrS	S
S jjrSS jrS rS rSS jrSr	g)LumaConceptChain5   Nc                l    / U l         Ub*  U H#  nUS:w  d  M  U R                  [        US95        M%     g g )NNonerK   )conceptsr6   rH   )r   str_listrB   s      r   r    LumaConceptChain.__init__6   s6    +-;HH[Q/0   r   c                :    U R                   R                  U5        g r   )rS   r1   )r   concepts     r   r6   LumaConceptChain.add=   s    W%r   c                    [        U R                  5      S:X  a  g / nU R                   H7  nUR                  S:X  a  M  UR                  [	        UR                  S95        M9     [        U5      S:X  a  g U$ )Nr   rR   rK   )r9   rS   rL   r1   LumaConceptObject)r   api_conceptsrW   s      r   r'   !LumaConceptChain.create_api_model@   sh    t}}"02}}G{{f$ 1gkk BC % |!r   c                b    [        5       nU R                   H  nUR                  U5        M     U$ r   )rO   rS   r6   )r   rB   rW   s      r   rC   LumaConceptChain.cloneL   s(    }}GEE'N %r   c                n    U R                  5       nUR                   H  nUR                  U5        M     U$ r   )rC   rS   r6   )r   otherrB   rW   s       r   clone_and_merge LumaConceptChain.clone_and_mergeR   s+    JJL~~GEE'N &r   )rS   r   )rT   rF   )rW   rH   )r`   rO   )
r   r   r   r   r    r6   r'   rC   ra   r   r   r   r   rO   rO   5   s    1&
r   rO   c                D    / nU (       a  UR                  S5        U/ SQ-   $ )NrR   )"
truck_left	pan_rightpedestal_down	low_anglepedestal_upselfiepan_left
roll_rightzoom_inover_the_shoulderorbit_right
orbit_leftstatictiny_planet
high_anglebolt_cam
dolly_zoomoverheadzoom_outhandheld	roll_leftpovaerial_dronepush_in
crane_downtruck_right	tilt_downelevator_doorstilt_upground_levelpull_outaerialcrane_up	eye_level)r1   )include_nonerS   s     r   get_luma_conceptsr   Y   s(    H # # #r   c                      \ rS rSrSrSrSrg)LumaImageModel   zphoton-1zphoton-flash-1r   N)r   r   r   r   photon_1photon_flash_1r   r   r   r   r   r      s    H%Nr   r   c                       \ rS rSrSrSrSrSrg)LumaVideoModel   zray-2zray-flash-2zray-1-6r   N)r   r   r   r   ray_2ray_flash_2ray_1_6r   r   r   r   r   r      s    EKGr   r   c                  0    \ rS rSrSrSrSrSrSrSr	Sr
S	rg
)LumaAspectRatio   z1:1z16:9z9:16z4:3z3:4z21:9z9:21r   N)r   r   r   r   	ratio_1_1
ratio_16_9
ratio_9_16	ratio_4_3	ratio_3_4
ratio_21_9
ratio_9_21r   r   r   r   r   r      s%    IJJIIJJr   r   c                  $    \ rS rSrSrSrSrSrSrg)LumaVideoOutputResolution   540p720p1080p4kr   N)	r   r   r   r   res_540pres_720p	res_1080pres_4kr   r   r   r   r   r      s    HHIFr   r   c                      \ rS rSrSrSrSrg)LumaVideoModelOutputDuration   5s9sr   N)r   r   r   r   dur_5sdur_9sr   r   r   r   r   r      s    FFr   r   c                      \ rS rSrSrSrSrg)LumaGenerationType   videor   r   N)r   r   r   r   r   r   r   r   r   r   r   r      s    EEr   r   c                  $    \ rS rSrSrSrSrSrSrg)	LumaState   queueddreaming	completedfailedr   N)	r   r   r   r   r   r   r   r   r   r   r   r   r   r      s    FHIFr   r   c                  ^    \ rS rSr% \" SSS9rS\S'   \" SSS9rS\S'   \" SS	S9rS\S
'   Sr	g)
LumaAssets   NzThe URL of the videodescriptionOptional[str]r   The URL of the imager   zThe URL of the progress videoprogress_videor   )
r   r   r   r   r   r   __annotations__r   r   r   r   r   r   r   r      s8     3IJE=J 3IJE=J$)$<[$\NM\r   r   c                  J    \ rS rSr% Sr\" SSS9rS\S'   \" SSS9rS	\S
'   Sr	g)r%      zUsed for image gen.The URL of the image referencer   r*   r$   !The weight of the image referenceconfloat(ge=0.0, le=1.0)r   r   N)
r   r   r   r   __doc__r   r$   r   r   r   r   r   r   r%   r%      s*    S&FGCG',S>a'bF$br   r%   c                  J    \ rS rSr% Sr\" SSS9rS\S'   \" SS	S9rS
\S'   Sr	g)LumaImageReference   zUsed for video genr   zInput type, defaults to imager   r   type.r   r*   r$   r   N)
r   r   r   r   r   r   r   r   r$   r   r   r   r   r   r      s)    5TUD-US&<=C=r   r   c                  F    \ rS rSr% \" SSS9rS\S'   \" SSS9rS\S	'   S
rg)LumaModifyImageRef   .r   r   r*   r$   r   r   r   r   N)	r   r   r   r   r   r$   r   r   r   r   r   r   r   r      s'    S&FGCG',S>a'bF$br   r   c                  .    \ rS rSr% \" SSS9rS\S'   Srg)	LumaCharacterRef   .The image identity objectr   LumaImageIdentity	identity0r   N)r   r   r   r   r   r   r   r   r   r   r   r   r      s    #(:U#VI Vr   r   c                  .    \ rS rSr% \" SSS9rS\S'   Srg)	r      .zThe URLs of the image identityr   rF   imagesr   N)r   r   r   r   r   r   r   r   r   r   r   r   r      s    c/OPFIPr   r   c                  F    \ rS rSr% \" SSS9rS\S'   \" SSS9rS\S	'   S
rg)LumaGenerationReference   
generationz"Input type, defaults to generationr   r*   r   .The ID of the generationidr   N)	r   r   r   r   r   r   r   r   r   r   r   r   r   r      s&    l0TUD#UC%?@B@r   r   c                  F    \ rS rSr% \" SSS9rS\S'   \" SSS9rS\S'   Srg)	LumaKeyframes   N r   z<Optional[Union[LumaImageReference, LumaGenerationReference]]frame0frame1r   )	r   r   r   r   r   r   r   r   r   r   r   r   r   r      s*    KPQUceKfFHfKPQUceKfFHfr   r   c                  .    \ rS rSr% \" SSS9rS\S'   Srg)	rZ      .zCamera Concept namer   r*   rL   r   N)r   r   r   r   r   rL   r   r   r   r   r   rZ   rZ      s    S&;<C<r   rZ   c                      \ rS rSr% \" SSS9rS\S'   \" \R                  SS9r	S\S	'   \" \
R                  S
S9rS\S'   \" SSS9rS\S'   \" SSS9rS\S'   \" SSS9rS\S'   \" SSS9rS\S'   Srg)LumaImageGenerationRequest   .The prompt of the generationr   r*   promptz'The image model used for the generationr   model"The aspect ratio of the generationOptional[LumaAspectRatio]aspect_ratioNzList of image reference objectszOptional[list[LumaImageRef]]	image_refzList of style reference objects	style_refr   zOptional[LumaCharacterRef]character_refz!The modify image reference objectzOptional[LumaModifyImageRef]modify_image_refr   )r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r      s    )GHFCH!."9"9GpqE>q.3O4N4N  ]A  /BL+  B.3DFg.hI+h.3DFg.hI+h05dHc0dM-d5:4Mp5q2qr   r   c                      \ rS rSr% \" SSS9rS\S'   \" \R                  SS9r	S\S	'   \" S
SS9r
S\S'   \" S
SS9rS\S'   \" S
SS9rS\S'   \" S
SS9rS\S'   \" S
SS9rS\S'   \" S
SS9rS\S'   Srg
)LumaGenerationRequest   .r   r   r*   r   z'The video model used for the generationr   r   NzThe duration of the generationz&Optional[LumaVideoModelOutputDuration]durationr   r   r   z The resolution of the generationz#Optional[LumaVideoOutputResolution]
resolutionzWhether to loop the videozOptional[bool]loopzThe keyframes of the generationzOptional[LumaKeyframes]	keyframesz&Camera Concepts to apply to generationz!Optional[list[LumaConceptObject]]rS   r   )r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rS   r   r   r   r   r   r      s    )GHFCH!."6"6DmnE>n7<TOo7pH4p.3DFj.kL+k6;DNp6qJ3q 3NOD.O).tAb)cI&c27Jr2sH/sr   r   c                      \ rS rSr% \" SSS9rS\S'   \" SSS9rS\S	'   \" SS
S9rS\S'   \" SSS9r	S\S'   \" SSS9r
S\S'   \" SSS9rS\S'   \" SSS9rS\S'   \" SSS9rS\S'   Srg)LumaGeneration   .r   r   r*   r   zGeneration type, image or videor   generation_typezThe state of the generationr   stateNz*The reason for the state of the generationr   failure_reasonz1The date and time when the generation was created
created_atzThe assets of the generationzOptional[LumaAssets]assetsz!The model used for the generationr   z#The request used for the generationz8Union[LumaGenerationRequest, LumaImageGenerationRequest]requestr   )r   r   r   r   r   r   r   r   r   r   r  r  r   r  r   r   r   r   r   r      s    C%?@B@*/Ab*cO'cS.KLE9L$)$<h$iNMiC-`aJa#(;Y#ZF Zs(KLE3LHMc  `E  IFGE  Fr   r   c                  @    \ rS rSr% SrS\S'   SrS\S'   SrS\S'   Srg)Luma2ImageRef   N
str | Noner$   data
media_typer   )	r   r   r   r   r$   r   r  r	  r   r   r   r   r  r     s     CD*!J
!r   r  c                      \ rS rSr% \" SSSS9rS\S'   SrS	\S
'   SrS	\S'   Sr	S	\S'   Sr
S	\S'   SrS	\S'   SrS\S'   SrS\S'   SrS\S'   Srg)Luma2GenerationRequesti  .   ip  )
min_length
max_lengthr*   r   Nr  r   r   r   styleoutput_formatzbool | None
web_searchzlist[Luma2ImageRef] | Noner   zLuma2ImageRef | Nonesourcer   )r   r   r   r   r   r   r   r   r   r   r  r  r  r   r  r   r   r   r   r  r    sg    d;FC;E:D*#L*#E: $M:$"J",0I)0#'F 'r   r  c                      \ rS rSr% SrS\S'   SrS\S'   SrS\S'   SrS\S'   Sr	S\S'   Sr
S	\S
'   SrS\S'   SrS\S'   Srg)Luma2Generationi  Nr  r   r   r   r   r  zlist[LumaImageReference] | Noneoutputr   failure_coder   )r   r   r   r   r   r   r   r   r   r  r  r   r  r   r   r   r   r  r    sS    B
D*E:E:!J
!.2F+2!%NJ%#L*#r   r  )F))
__future__r   enumr   typingr   r   torchpydanticr   r   r	   r   r   r,   rH   rO   r   r*   r   r   r   r   r   r   r   r   r%   r   r   r   r   r   r   rZ   r   r   r   r  r  r  r   r   r   <module>r     s|   "  "  / /$ $
B B 2 
! !H'T&S$ &
S$ c4 T 3 
d 
T ] ]c9 c> >c c
Wy WQ	 QAi A
gI g
=	 =r rtI tFY F"I "	(Y 	($i $r   