
    nKh              
          S r SSKrSSKrSSKrSSKrSSKrSSKrSSKJr  SSK	J	r	  SSK
Jr  SSKrSSKr SSKJr  \" S5        \" S5        \" S5        \" S5        \" S5        \" 5         SrSrSrSrSrS/ SQSSS.S/ SQSSS.S/ SQS S!S.S"/ S#QS$S%S.S&/ S'QS(S)S.S*/ S+QS,S-S.S..r0 S/S0_S1S0_S2S0_S3S0_S4S0_S5S6_S7S6_S8S6_S9S6_S:S6_S;S<_S=S<_S>S<_S?S<_S@S<_SAS<_SBSC_0 SDSC_SESC_SFSC_SGSH_SISH_SJSH_SKSL_SMSL_SNSL_SOSL_SPSL_SQSL_SRSL_SSSL_STSL_SUSL_SVSL_E0 SWSL_SXSL_SYSL_SZSL_S[SL_S\SL_S]SL_S^SL_S_SL_S`SL_SaS0_SbS6_ScS6_SdS0_SeS0_SfS6_SgS6_E0 ShS0_SiS0_SjS0_SkSL_SlS0_SmS0_SnS0_SoS0_SpS0_SqSL_SrSL_SsSL_StSL_SuSL_SvSL_SwSL_SxSL_E0 SySC_SzSL_S{SL_S|SL_S}SL_S~SL_SS0_SS0_SS<_SS<_SS0_SS6_SS6_SS<_SS6_SS6_SS0_E0 SS0_SS0_SS0_SS6_SS6_SS6_SSL_SSL_SSL_SSL_SSL_SSL_SS0_SSL_SSL_SSL_SSL_E0 SSL_SSL_SSL_SSL_SS0_SSL_SSH_SSL_SS0_SSL_SSL_SS0_SS0_SS0_SS0_SS0_SS6_ES6S6SHS.Er0 SZS_S[S_S^S_S{S_SUS_STS_SvS_SaS_ShS_SlS_SfS_SS_SS_SqS_StS_SzS_SS_S_S0ErS rS rS rS r S r! " S S5      r"S r#S r$S r%S r&S r'\(S:X  a  \'" 5         gg! \ a?    \" S5        SSKr\R&                  " \R(                  SS	S
S/5        SSKJr  \" S5         GNf = f)u  
PROFESSIONAL IMAGE GENERATOR - ALL CATEGORIES VERSION
======================================================
Features:
✅ ALL Category Types Supported - No Restrictions
✅ Auto Model Selection Based on Category Keywords
✅ 100+ Category Types Enabled
✅ Intelligent Category Mapping
✅ 1920x1080 Full HD Resolution
✅ Professional Quality Output

Author: Professional Image Generation System
Date: 2025
    N)Path)datetime)BytesIO)Imageu   📦 Installing Pillow...z-mpipinstallpillowu   ✅ Pillow installed!
P================================================================================z:PROFESSIONAL IMAGE GENERATOR - ALL CATEGORIES VERSION V3.0uH   ✅ Full HD 1920x1080 | ALL Categories Supported | Smart Model Selectionz%https://image.pollinations.ai/prompt/professional_imagesi  i8  Tzflux-realism)	realisticphotorealistichyperrealisticphotophotographyzultra photorealistic, professional photography, extremely detailed, sharp focus, perfect lighting, 8K UHD, RAW photo, high quality, film grain, Fujifilm XT3, professional color grading, award winning photographyzWcartoon, anime, illustration, painting, drawing, art, sketch, 3d render, deformed, ugly)modelkeywordssuffixnegativezflux-3d)3dcgirenderrendered	3d-renderoctanez3D render, octane render, unreal engine 5, ray tracing, ultra detailed 3D model, CGI, volumetric lighting, ambient occlusion, subsurface scattering, physically based rendering, 8K resolution, studio lightingzA2d, flat, cartoon, anime, painting, sketch, low poly, low qualityzflux-cablyai)cartoonisticcartoonanimated	animationdisneypixartoonzcartoon style, disney pixar style, animated, colorful, clean lines, vibrant colors, professional animation, studio quality, character design, expressive, polished, high quality cartoonz7realistic, photo, 3d render, dark, gritty, horror, uglyzflux-cartoon)comic
comic-bookgraphic-novelpop-artgraphiccomicszcomic book style, comic art, graphic novel, bold lines, vibrant colors, dynamic composition, pop art, professional comic illustration, ink and color, halftone dotsz0realistic, photo, 3d render, blurry, low qualityz
flux-anime)animemangaanime-stylemanga-stylezjapanese-animezanime style, manga art, japanese animation, cel shaded, vibrant colors, expressive eyes, detailed hair, professional anime artwork, studio quality, beautiful lightingz<realistic, photo, western cartoon, 3d render, ugly, deformedflux)	cinematiccinematic-shotmoviefilm	hollywoodepiczcinematic shot, movie scene, cinematic lighting, epic composition, dramatic atmosphere, film photography, anamorphic lens, depth of field, color graded, professional production, blockbuster movie quality, 35mm film, IMAX qualityz2amateur, low quality, snapshot, boring compositionr   r   r   r"   r(   r-   r   r   r   r   r   zprofessional-photographyr   r   r   r   zoctane-renderzunreal-enginer   r   r   r   r   r    r!   r#   r"   r$   r%   r'   r)   r(   r*   r+   r/   r-   r0   r1   r2   r.   artisticartpaintingoil-painting
watercolorzdigital-artzdigital-paintingzconcept-artillustrationfantasysci-fizscience-fiction
futuristic	cyberpunk	steampunkspaceportrait	characterzcharacter-designfaceheadshotarchitecturalarchitecture	landscapenature	cityscapeenvironmentproductzproduct-photography
commercialadvertising	marketingabstractmoderncontemporary
minimalist	geometricsketchpencildrawingzline-artdarkhorrorgothicnoirdramaticvintageretro80s90sz
old-schoolgamezgame-art	pixel-artzlow-polyvoxelfashionbeautyglamour	editorialtexturematerialpbrimpressionistexpressionistsurreal
surrealismcubistbaroquerenaissancemoodyatmosphericdreamyetherealmysticalmagicalmedievalancientz
modern-dayzpost-apocalypticjapanesechinesekoreanwesterneasternanimalwildlifefoodinteriorexteriorvehicle)weaponrobotmechaz9magical, mystical, enchanted, fantasy world, epic fantasyz;futuristic, advanced technology, space age, sci-fi elementszEneon lights, cyberpunk aesthetic, futuristic city, blade runner stylez8dark, eerie, creepy, horror atmosphere, dramatic shadowsz8watercolor painting, soft colors, artistic brush strokesz1oil painting style, classical art, museum qualityz7pencil sketch, hand drawn, artistic lines, sketch stylez>professional portrait, studio lighting, shallow depth of fieldz4beautiful landscape, scenic view, nature photographyzIproduct shot, clean background, professional lighting, commercial qualityz@architectural photography, professional composition, clean lineszEfashion photography, haute couture, editorial style, magazine qualityz4vintage style, retro aesthetic, aged look, nostalgicz3abstract art, artistic composition, creative designz4minimalist design, clean composition, simple elegantz1dark atmosphere, moody lighting, dramatic shadowsz.pixel art style, retro gaming, 8-bit aestheticz@steampunk aesthetic, Victorian era, brass and copper, mechanicalc                   ^ U R                  5       R                  5       nUR                  SS5      R                  SS5      mT[        ;   a	  [        T   $ T[        ;   a  T$ [        R                  5        H#  u  p#US    H  nUT;   d  TU;   d  M  Us  s  $    M%     [        U4S jS 5       5      (       a  g[        U4S jS	 5       5      (       a  g
[        U4S jS 5       5      (       a  g[        U4S jS 5       5      (       a  g[        U4S jS 5       5      (       a  g[        U4S jS 5       5      (       a  g[        SU  S35        g)z
Intelligently detect which main category to use based on input

Args:
    category: Input category string

Returns:
    Main category name
 -_r   c              3   ,   >#    U  H	  oT;   v   M     g 7fN .0wordcategory_normalizeds     S/var/www/eduai.edurigo.com/image_generation/testing/pollinations_image_generator.py	<genexpr>'detect_category_type.<locals>.<genexpr>T  s     
E3D4&&3D   )realr   r   c              3   ,   >#    U  H	  oT;   v   M     g 7fr   r   r   s     r   r   r   V  s     M5LT((5Lr   )r   r   r   r   c              3   ,   >#    U  H	  oT;   v   M     g 7fr   r   r   s     r   r   r   X  s     S5RT((5Rr   )r   animr   r   c              3   ,   >#    U  H	  oT;   v   M     g 7fr   r   r   s     r   r   r   Z       H5GT((5Gr   )r"   r)   r"   c              3   ,   >#    U  H	  oT;   v   M     g 7fr   r   r   s     r   r   r   \  r   r   )r(   r)   r(   c              3   ,   >#    U  H	  oT;   v   M     g 7fr   r   r   s     r   r   r   ^  s     Q5PT((5Pr   )cinemar/   r0   r-   u      ℹ️ Unknown category 'z', using 'cinematic' as default)lowerstripreplaceEXTENDED_CATEGORIESMAIN_CATEGORIESitemsanyprint)categorycategory_lowermain_catconfigkeywordr   s        @r   detect_category_typer   8  s6    ^^%++-N(00c:BB3L 11"#677 o-"" ,113j)G--1D1O * 4 
E3D
EEE	M5LM	M	M	S5RS	S	S	H5GH	H	H	H5GH	H	H	Q5PQ	Q	Q 
(
2Q
RS    c                    UR                  5       R                  5       R                  SS5      R                  SS5      n[        U5      n[        U   nSnUS   nSnU[
        ;   a  S[
        U    3nSnU SU  SU U SU 3n	US	:X  a  U	S
-  n	U	$ US:X  a  U	S-  n	U	$ US:X  a  U	S-  n	U	$ US:X  a  U	S-  n	U	$ US:X  a  U	S-  n	U	$ US:X  a  U	S-  n	U	$ )z
Enhance prompt based on category with intelligent additions

Args:
    prompt: Original user prompt
    category: Selected category

Returns:
    Enhanced prompt string
r   r   r   zLmasterpiece, best quality, ultra detailed, professional, perfect compositionr    , z>perfect anatomy, perfect perspective, golden ratio compositionr   zB, shot on Canon EOS R5, 85mm lens, f/1.4, professional photographyr   zD, rendered in Octane, global illumination, HDRI lighting, 8K qualityr-   z4, cinematic composition, film grain, anamorphic lensr(   z#, trending on pixiv, studio qualityr   z), Disney animation studios, Pixar qualityr"   z), professional comic artist, Marvel style)r   r   r   r   r   CATEGORY_ENHANCEMENTS)
promptr   r   main_categorycategory_configquality_prefixstyle_suffixextra_enhancement	technicalenhanceds
             r   enhance_prompt_for_categoryr   f  sW    ^^%++-55c3?GGSQN )2M%m4O dN #8,L .. !6~!F GH QI !!F82l^<M;NbQZP[\H #XX O 
$	ZZ O 
+	%JJ O 
'	!99 O 
.	(?? O 
'	!??Or   c                 J    [        U 5      n[        U   R                  SS5      $ )zo
Get negative prompt based on category

Args:
    category: Category name

Returns:
    Negative prompt string
r   r   )r   r   getr   r   s     r   get_negative_promptr     s&     )2M=)--j"==r   c                 0    [        U 5      n[        U   S   $ )ze
Get the best model for a given category

Args:
    category: Category name

Returns:
    Model name
r   )r   r   r   s     r   get_model_for_categoryr     s     )2M=)'22r   c                    [        U 5      nSSSSSSS.nUR                  US5      u  pE[        [        R                  " UR                  5       5      R                  5       S	S
 S5      n[        R                  " SS5      nXg-   XT-
  -  nXH-   n	U	$ )z
Generate optimized seed based on category and prompt

Args:
    category: Category name
    prompt: Prompt text

Returns:
    Optimized seed value
)    )r   '  )r   :  )r    N  )r   a  )r   0u  r3   )r   r   N      r   r   )	r   r   inthashlibmd5encode	hexdigestrandomrandint)
r   r   r   seed_rangesmin_seedmax_seedprompt_hashrandom_component	base_seedoptimized_seeds
             r   get_optimized_seedr     s     )2M "&#K %FHgkk&--/2<<>rBBGK~~a./H4GHI)Nr   c                   N    \ rS rSrSrS rS rSS jrSS jrSS jr	S	 r
S
 rSrg)ProfessionalImageGeneratori  zBProfessional image generation system supporting ALL category typesc                     SU l         U R                  5         [        S5        [        S[         S35        [        S5        [        S5        g )Nr   u*   ✅ ProfessionalImageGenerator initializedu   📁 Output folder: /u/   🎨 ALL Categories Supported - No Restrictionsu(   🤖 Intelligent Model Selection Enabled)generation_countcreate_output_foldersr   OUTPUT_FOLDER)selfs    r   __init__#ProfessionalImageGenerator.__init__  sC     !""$:;$]O156?A8:r   c                    [        [        5      nUR                  SS9  [        R	                  5        H  nX-  R                  SS9  M     US-  R                  SS9  US-  R                  SS9  US-  R                  SS9  g)z(Create organized output folder structureT)exist_okothermetadatatestsN)r   r   mkdirr   keys)r   	base_pathr   s      r   r   0ProfessionalImageGenerator.create_output_folders  s    '	& (,,.H!(($(7 / 
W	##T#2	Z	&&&5	W	##T#2r   Nc           	         Uc  [         nUc  [        nU =R                  S-  sl        UR                  5       R	                  5       n[        U5      nUn[        X5      n[        U5      n	[        X!5      n
[         [        R                  R                  U5       3nUUUU
SS[        [        5      R                  5       SS.nU	(       a  XS'   [        SU R                   35        [        SUR!                  5        SUR!                  5        35        [        S	U 35        [        S
U SU 35        [        SU
 35        [        SUSS  S35        [        S5         [        R"                  " XSS9nUR$                  S:X  a  [&        R(                  " [+        UR,                  5      5      nUR.                  S:w  a  UR1                  S5      n[+        5       nUR3                  USSSS9  UR5                  S5        UR7                  5       n[9        U5      S-  n[        S5        [        SUS S35        [        S5        U$ [        S UR$                   35        [        S!UR:                  SS  35        g! [        R<                  R>                   a    [        S"5         g[@         a5  n[        S#[        U5       35        SSK!nURE                  5          SnAgSnAff = f)$a|  
Generate single image and return bytes for FastAPI
Accepts ANY category type - no restrictions

Args:
    prompt: The text prompt
    category: ANY category name (used for prompt enhancement)
    model_name: Specific model to use (flux, nano-banana, turbo)
    width: Image width (default 1920)
    height: Image height (default 1080)

Returns:
    Image bytes or None if failed
N   true)widthheightr   seednologoenhancesafenofeednegative_promptu   
🎨 Generating Image #z   Category: u    → Main: z
   Model: z   Resolution: xz	   Seed: z   Prompt: <   z...u$      ⏳ Processing (15-30 seconds)...x   )paramstimeout   RGBPNGd   F)formatqualityoptimizer      u      ✅ SUCCESSu      📊 Size: z.2fz MBu       🎯 Quality: Professional HDu      ❌ API Error: HTTP z   Response: u4      ❌ Timeout: Request took longer than 120 secondsu      ❌ Generation Failed: )#QUALITY_WIDTHQUALITY_HEIGHTr   r   r   r   r   r   r   API_URLrequestsutilsquotestrSAFETY_ENABLEDr   upperr   status_coder   openr   contentmodeconvertsaveseekgetvaluelentext
exceptionsTimeout	Exception	traceback	print_exc)r   r   r   
model_namer   r   r   r   enhanced_promptr   r   urlr   responseimageoutputimage_bytesimage_size_mber  s                       r   generate_single_image_bytes6ProfessionalImageGenerator.generate_single_image_bytes  s     =!E>#F" >>#))+ -X6  6fG-h7 "(3 	(....?@A '--/	
 (7$%)$*?*?)@ABhnn./{=;N;N;P:QRS
5'"#wax01	$ !F3BK=,-46%	||CDH##s*

78+;+;#<= ::&!MM%0E !

6%u
MA$oo/ #K 0K @(}S&9=>8:"" /0D0D/EFGhmmDS&9%:;<""** 	HJ 	.s1vh78!		s%   C!I2 >3I2 2)K	K&+KKc           
         / n[        U5       GHr  n[        SUS-    SU 35        U R                  UUUUUS9n	U	c  [        SUS-    35        MA  [        R                  " 5       R                  S5      SS n
[        R                  " U S	U 3R                  5       5      R                  5       SS
 nUR                  5       SS nS	R                  U5      R                  5       R                  SS5      R                  SS5      SS nU S	U S	U
 S	US-    S	U 3	n[        R                  " U	5      R!                  S5      nUR#                  UUS.5        [        SU 35        XS-
  :  d  GM\  [$        R&                  " S5        GMu     U$ )aI  
Generate multiple images and return list with names and base64 data

Args:
    prompt: The text prompt
    category: Category name for enhancement
    model_name: Model to use
    width: Image width
    height: Image height
    image_count: Number of images to generate

Returns:
    List of dicts with 'name' and 'base64' keys
u   
📸 Generating image r   r   )r   r   r  r   r   Nu       ❌ Failed to generate image %Y%m%d_%H%M%S_%fr         ,r   .   zutf-8)namebase64u      ✅ Generated: )ranger   r%  r   nowstrftimer   r   r   r   splitjoinr   r   r0  	b64encodedecodeappendtimesleep)r   r   r   r  r   r   image_countimagesir"  	timestampr   prompt_wordsprompt_brief
image_namebase64_datas                   r   generate_multiple_images3ProfessionalImageGenerator.generate_multiple_imagesY  s    {#A,QqSE;-@A ::!% ; K "81>? !//0BCCRHI!++!o&<&<&>?IIKBQOK!<<>"1-L88L1779AA#rJRRSVXZ[\_]_`L$:Q|nAi[!A#a}UJ !**;7>>wGKMM"% 
 &zl34 ?"

1G $J r   c                    Uc  [         nUc  [        nU R                  XX4U5      nUc  SSS.$ [        U5      nU[        ;   a  UnOSn[
        R                  " 5       R                  S5      SS n	[        R                  " UR                  5       5      R                  5       SS n
UR                  5       SS	 nS
R                  U5      R                  5       R                  SS5      R                  SS5      SS nU S
U S
U	 S
U
 S3n[!        ["        5      U-  U-  n[%        US5       nUR'                  U5        SSS5        [
        R                  " 5       R)                  5       U R*                  S.U[-        X5      [/        U5      S.UU[1        U5      U SU 3[3        U5      S-  [5        X!5      S.S.n[!        ["        5      S-  UR                  SS5       -  n[%        US5       n[6        R8                  " UUSS9  SSS5        [;        SU 35        [;        SU 35        S[=        U5      [=        U5      US.$ ! , (       d  f       GN	= f! , (       d  f       NU= f) z
Generate image and save to disk

Args:
    prompt: The text prompt
    category: Category name
    model_name: Model to use
    width: Image width
    height: Image height

Returns:
    Dictionary with result info
NFzImage generation failed)successerrorr   r(  r)  r*  r+  r   r,  r   r-     z.pngwb)r>  generation_number)originalr   r   r   r  )r   r   r   
resolutionfile_size_mbr   )generation_infoprompt_datatechnical_detailsr   z.jsonw   )indentu      💾 Saved: u      📄 Metadata: T)rF  pathmetadata_pathr   )r  r  r%  r   r   r   r2  r3  r   r   r   r   r4  r5  r   r   r   r   r  write	isoformatr   r   r   r   r  r   jsondumpr   r
  )r   r   r   r  r   r   r"  r   folderr>  r   r?  r@  filenameoutput_pathfr   rU  s                     r   generate_and_save_image2ProfessionalImageGenerator.generate_and_save_image  sW    =!E>#F66v\bc$/HII -X6O+"FF LLN++,>?D	kk&--/2<<>rB||~bq)xx-335==c2FNNsTVWX[Y[\Zqa	{!K=M =)F2X=+t$GGK  % &\\^557%)%:%: 
 #7I/9 %!./9!&q1 #K 0K @*8<"
( ]+j8h>N>NvW^>_=`a-%IIh!, & 	}-."=/23 $ / 	
 	
? %$2 &%s   (H<(I<
I
Ic           
          [         R                  5        VVs0 s H"  u  pUUS   UR                  SS5      US   S._M$     snn[        [	        [        5      [	        [         5      -   SS.$ s  snnf )z.Get information about all supported categoriesr   descriptionr   r   )r   ra  r   zdAll category types are supported. Unknown categories will be intelligently mapped to the best model.)main_categoriesextended_categoriestotal_supportedmessage)r   r   r   r   r  )r   r/  r   s      r   get_all_categories_info2ProfessionalImageGenerator.get_all_categories_info  s     %4$9$9$;  %<LD #G_#)::mR#@ &z 2 
 %<  $7"#67#o:NN}
 	
 s   )A+c           	         [        S5        [        S[        U5       S35        [        S5        [        SU 35        [        S5        / n[        US5       H  u  pE[        SU S[        U5       S	U 35        [        S
5        U R                  X5      nUR	                  UUS.5        U[        U5      :  d  Mc  [        S5        [
        R                  " S5        M     [        S U 5       5      n[        S5        [        S5        [        S5        [        SU S[        U5       35        [        S[        U5      U-
   S[        U5       35        [        S5        U$ )z
Test generation with multiple categories

Args:
    prompt: Prompt to use
    categories_list: List of categories to test

Returns:
    List of results
Q
================================================================================u   🧪 TESTING z CATEGORIESr
   u   📝 Prompt: r   
[r   z] Testing: <------------------------------------------------------------)r   result   
⏳ Waiting 2 seconds...rR  c              3   \   #    U  H"  oS    R                  SS5      (       d  M  Sv   M$     g7f)rl  rF  Fr   Nr   r   rs     r   r   FProfessionalImageGenerator.test_multiple_categories.<locals>.<genexpr>  s!     QGq{y%/PGs   ,	,u   ✅ TEST COMPLETE	Success: zFailed: )r   r  	enumerater^  r8  r9  r:  sum)r   r   categories_listresultsidxr   rl  
successfuls           r   test_multiple_categories3ProfessionalImageGenerator.test_multiple_categories  s<    	mc/23;?@ffX&'f&:MCCuAc/23;xjIJ(O11&CFNN$  
 S))23

1 ; QGQQ
m!"f	*Qs7|n56W
231S\NCDfr   )r   )NN)NNr   )r,   NN)__name__
__module____qualname____firstlineno____doc__r   r   r%  rC  r^  rf  rz  __static_attributes__r   r   r   r   r     s-    L;3fP6pL
\
 *r   r   c                     [        S5        [        S5        [        S5        [        5       n SSS.SSS.SS	S.S
SS.SSS.SSS.SSS.SSS.SSS.SSS./
n/ n[        US5       H  u  p4[        SU S[        U5       SUS   R	                  5        35        [        SUS    35        [        S5        U R                  US   US   S9nUR                  U5        U[        U5      :  d  M  [        S 5        [        R                  " S!5        M     [        S" U 5       5      n[        S#5        [        S$5        [        S5        [        S%U S[        U5       35        [        S5        g&)'zTest most popular categoriesr
   zTESTING POPULAR CATEGORIESz!A beautiful sunset over mountainsr   r   r   zA futuristic robot characterr   zA cute cartoon dog playingr   zA superhero in action poser"   zAn anime girl with blue hairr(   zAn epic battle scener-   zA magical fantasy castler:   zA cyberpunk city at nightr=   zA professional portrait photor@   z A watercolor painting of flowersr8   r   rj  r   ] r   zPrompt: r   rk  rm  rR  c              3   V   #    U  H  oR                  S S5      (       d  M  Sv   M!     g7f)rF  Fr   Nro  rp  s     r   r   *test_popular_categories.<locals>.<genexpr>H  s     C155E+BQQs   )	)ri  u$   ✅ POPULAR CATEGORIES TEST COMPLETErs  N)
r   r   rt  r  r  r^  r8  r9  r:  ru  )	generator
test_casesrw  rx  testrl  ry  s          r   test_popular_categoriesr     s|    
&M	
&'	&M*,I 7KP1tD/^L/WE1wG){C-9E.KH2
K5<PJ Gz1-	C5#j/*"T*-=-C-C-E,FGHh()*h22>*% 3 

 	vZ ./JJqM .  CCCJ	-	
01	&M	Ij\3w<.
12	&Mr   c                      [        S5        [        S5        [        S5        [        5       n / SQnSnU R                  X!5      nU$ )z6Test various category types to demonstrate flexibilityr
   zTESTING ALL CATEGORY TYPES)r   r   r   r"   r(   r-   r:   r;   r=   r8   r7   rS   r@   rF   rJ   rD   rW   r[   r`   rb   z'A majestic dragon in a mystical settingr   r   rz  )r  test_categoriesr   rw  s       r   test_all_category_typesr  P  sF     
&M	
&'	&M*,IO 7F00IGNr   c            
         [        S5        [        S5        [        S5        [        5       n SSS.SSS.SS	S./n[        US
5       Hp  u  p#[        SU S[        U5       SUS   R	                  5        35        U R                  US   US   S9nU[        U5      :  d  MZ  [        R                  " S5        Mr     [        S5        [        S5        [        S5        g)z"Quick test with 3 different stylesr
   zQUICK TEST - 3 CATEGORIESzA red sports carr   r  zA cute robot characterr   zA magical forest scener:   r   rj  r   r  r   r   rR  ri  u   ✅ QUICK TEST COMPLETEN)r   r   rt  r  r  r^  r9  r:  )r  r  rx  r  rl  s        r   
quick_testr  h  s    	&M	
%&	&M*,I &;?+>+CJ z1-	C5#j/*"T*-=-C-C-E,FGH22>*% 3 

 Z JJqM . 
-	
#$	&Mr   c                      [        S5        [        S5        [        S5        [        S5        [        S5        [        5       n / SQnSnU R                  X!5      nU$ )z*Test with completely custom category namesr
   zTESTING CUSTOM CATEGORY NAMESz7Testing system's ability to handle any category name...)
zepic-battle-scenezprofessional-headshotzgame-character-designzbook-cover-artzmovie-posterzalbum-coverzt-shirt-designzlogo-designzchildren-book-illustrationzscientific-diagramz"A creative and professional designr  )r  custom_categoriesr   rw  s       r   test_custom_categoriesr    sU    	&M	
)*	&M	
CD	&M*,I 2F00KGNr   c            
          [        S5        [        S5        [        S5        [        S5        [        S5        [        S5        [        S5        [        S5        [        S5        [        S5        [        R                  5        H'  u  p[        S	U R                  5        S
US    35        M)     [        S5        [        S5        [        S5        / SQn[        SR	                  U5      5        [        S5        [        S5        [        S5        [        S5        [        S5        [        S5        [        S5        [        S5        [        S5        [        S5        [        S5        [        S5        [        S5      R                  5       nUS:X  a  [        5         GOUS:X  a  [        5         GOUS:X  a  [        5         GOUS:X  a  [        5         GOUS:X  aO  [        S5      R                  5       n[        S5      R                  5       n[        5       nUR                  XE5        GO4US :X  Ga  [        5       nUR                  5       n[        S5        [        S!5        [        S5        [        S"[        US#   5       35        US#   R                  5        H  n [        S	U  35        M     [        S$[        US%   5       35        [!        US%   R                  5       5      n[#        S&[        U5      S'5       H%  n	[        S(SR	                  XU	S'-    5       35        M'     [        S)US*    35        [        S5        OUS+:X  a  [        S,5        g-[        S.5        g-[        S5        [        S/5        [        S0[$         S135        [        S5        g-)2z#Main function with interactive menuri  z5PROFESSIONAL IMAGE GENERATOR - ALL CATEGORIES VERSIONr
   u!   
✅ ALL CATEGORY TYPES SUPPORTEDu0   ✅ NO RESTRICTIONS - ANY CATEGORY NAME ACCEPTEDu   ✅ INTELLIGENT MODEL SELECTIONu   ✅ 100+ CATEGORY MAPPINGSzAVAILABLE MAIN CATEGORIESu     • z: r   zEXAMPLE SUPPORTED CATEGORIES)r   r   r   r"   r(   r-   r:   r;   r=   r8   r7   rS   r@   rF   rW   r[   r`   rb   rJ   rD   r>   rV   r\   rN   rQ   r_   r)   r   r    r   z4
...and MANY MORE! System accepts ANY category name.zTESTING MENUu   1️⃣  Quick Test (3 images)u,   2️⃣  Test Popular Categories (10 images)u,   3️⃣  Test All Category Types (20 images)u+   4️⃣  Test Custom Categories (10 images)u!   5️⃣  Custom Single Generationu&   6️⃣  Show All Supported Categoriesu   7️⃣  Exitz
Select option (1-7): 12345z
Enter prompt: zEnter category (any name): 6zALL SUPPORTED CATEGORIESz
Main Categories: rb  z
Extended Categories: rc  r      z  
re  7u   
👋 Goodbye!Nu   
❌ Invalid optionu   🎉 OPERATION COMPLETEu   📁 Check images in: r   )r   r   r   r  r5  inputr   r  r  r  r  r   r^  rf  r  r   listr1  r   )
r/  r   example_categorieschoicer   r   r  inforv  r=  s
             r   mainr    s    
-	
AB	&M	
./	
<=	
+,	
&'	-	
%&	&M'--/tzz|nBvg&789 0 
-	
()	&M 
$))&
'(	
AB	-	.	&M	
*+	
89	
89	
78	
-.	
23	/	&M,-335F}	3!	3!	3 	3)*00267==?.0	))&;	3.0	002m()f#C->(?$@#ABC*+002DF4&/" 3'D1F,G(H'IJKt$9:??ABq#o.2ABtyy1Q3!789:; 34	?#$%f	3 $%	-	
#$	"=/
34	&Mr   __main__))r  r  rX  r9  r   r   r0  pathlibr   r   ior   sysrePILr   ImportErrorr   
subprocess
check_call
executabler  r   r  r  r  r   r   r   r   r   r   r   r   r   r  r  r  r  r  r|  r   r   r   <module>r     s	            
 	% f B C f P Q f  2%    ] hm	 N dW	  c MM	  \ xF	 V {R	 Y yH	U0fhkh kh [	h
 ;h h 
4h dh h Th Th  ~!h" #h$ %h& n'h( ^)h* N+h0 '1h2 W3h4 w5h6 g7h< W=h> 7?h@ 7AhF [GhH KIhJ KhL KMhN kOhT UhV 
;WhX YhZ K[h\ +]h^ ;_h` ahb ;chd Kehj {khl kmhn {ohp +qhr sht uhv [wh| }h~ h@ AhB KChD EhJ TKhL DMhN OhP kQhR ShT ;UhZ {[h\ ;]h^ +_h` ;ahb chh ihj kkhl Kmhn +ohp qhv kwhx kyhz {{h| }hB KChD kEhF kGhH KIhJ KhP {QhR [ShT 
>UhV 
>WhX +Yh^ D_h` ahb chd ehf Tghl {mhn kohp {qhr shx tyhz {h| 
4}hB [ChD [EhF {GhH +IhJ kKhL {MhN ;OhT [UhV ;WhX kYhZ [h\ ]h^ {_hd ehf {ghh +ihj khp qhr {sht kuhv {whx {yh~ kh@ AhB KChD EhF GhH tIhJ Oh VJK X H	
 L G G P G Z W V E E H  ?!" A#$ S% 2+\0f>3FA AP
-`0:DRj zF {  %	
%&3>>4	8LM	
#$%s   J AKK