570 lines
24 KiB
Python
570 lines
24 KiB
Python
import json
|
|
import re
|
|
|
|
# Load creds
|
|
with open("/home/creserver/Desktop/Vaishno_workspace/Jsons/credentials_23-10-2026.json") as f:
|
|
creds = json.load(f)["data"]
|
|
|
|
# Load original FASTAPI_BACKEND_API_DOCS.html
|
|
with open("/home/creserver/Desktop/Vaishno_workspace/docs/FASTAPI_BACKEND_API_DOCS.html") as f:
|
|
html = f.read()
|
|
|
|
idx1 = html.find('<script id="api-data" type="application/json">') + len('<script id="api-data" type="application/json">')
|
|
idx2 = html.find('</script>', idx1)
|
|
orig_data = json.loads(html[idx1:idx2])
|
|
|
|
# Index original endpoints
|
|
orig_eps = {}
|
|
for s in orig_data["sections"]:
|
|
for ep in s["eps"]:
|
|
orig_eps[ep["path"]] = ep
|
|
orig_eps[ep["path"].rstrip("/")] = ep
|
|
orig_eps[ep["id"]] = ep
|
|
|
|
def get_ep(path):
|
|
if path in orig_eps:
|
|
return orig_eps[path]
|
|
p_strip = path.rstrip("/")
|
|
if p_strip in orig_eps:
|
|
return orig_eps[p_strip]
|
|
# search substring
|
|
for k, v in orig_eps.items():
|
|
if path in k or k in path:
|
|
return v
|
|
return None
|
|
|
|
# Inlined custom_mappings
|
|
custom_mappings = {
|
|
"Cre_Aws_Waifu2x_Model": [
|
|
("/new_enhancer/image/", "image/", "Real-ESRGAN + CodeFormer Super-Resolution"),
|
|
("/new_enhancer/image_previous/", "image_previous/", "Face & Image Enhancer — Legacy Alias")
|
|
],
|
|
"Cre_Aws_Colorization_Model": [
|
|
("/colorization/image/", "image/", "DeOldify B&W Photo Colorization")
|
|
],
|
|
"Cre_Aws_Old_Photo_Restore_Model": [
|
|
("/oldPhotoRestore/image/", "image/", "Scratch, Crease & Fading Restoration")
|
|
],
|
|
"Cre_Aws_Advance_Image_Segment_Anything_Dichotomous_Model": [
|
|
("/advance_image_segment_anything_dichotomous/image/", "image/", "DIS + SAM Dichotomous Segmentation")
|
|
],
|
|
"Cre_Aws_cloth_segmentation_Model": [
|
|
("/cloth_segmentation/image", "image", "Cloth Segmentation (Clothing Identifier)")
|
|
],
|
|
"Cloth_Segmentation_Model_V2": [
|
|
("/cloth_segmentation_v2/segment/", "segment/", "Cloth Segmentation V2 (Multi-Part Router)")
|
|
],
|
|
"dress_segmentation_auto": [
|
|
("/dress_segmentation_auto_newurl/image/", "image/", "Automated Garment Segmentation")
|
|
],
|
|
"Cre_Aws_Lama_Cleaner_Model": [
|
|
("/lamaCleaner/image/", "image/", "LaMa Inpainting Object Remover")
|
|
],
|
|
"Cre_Aws_Background_Remover_Model": [
|
|
("/background_remover_p3m/image/", "image/", "P3M-Net Alpha Matte Background Remover")
|
|
],
|
|
"Cre_Aws_Cartoon_Model": [
|
|
("/cartoon_effects/image/", "image/", "AnimeGAN & Cartoon Effects")
|
|
],
|
|
"Face_Coordinates": [
|
|
("/face_landmark/image/", "image/", "68-Point & 468-Point Facial Landmark Detection"),
|
|
("/face_landmark/image2/", "image2/", "Face Landmark — Mesh Array (image2)"),
|
|
("/face_landmark/image3/", "image3/", "Face Landmark — Contour (image3)"),
|
|
("/face_landmark/image4/", "image4/", "Face Landmark — Variant 4 (image4)"),
|
|
("/face_landmark/image5/", "image5/", "Face Landmark — Variant 5 (image5)"),
|
|
("/face_landmark/image6/", "image6/", "Face Landmark — Eye Iris Mask (image6)"),
|
|
("/face_landmark/image7/", "image7/", "Face Landmark — Visualized Overlay PNG (image7)"),
|
|
("/face_landmark/get_eye_mask", "get_eye_mask", "Face Landmark — Fetch Eye Mask (get_eye_mask)")
|
|
],
|
|
"Face_Swapper": [
|
|
("/face_swapper/image/", "image/", "InsightFace Single & Couple Face Swapper"),
|
|
("/face_swapper/couple_swap/", "couple_swap/", "Couple Face Swap (Two Source Targets)"),
|
|
("/face_swapper/eyes/", "eyes/", "Eye Region Targeted Swap"),
|
|
("/face_swapper/open_eye_new/", "open_eye_new/", "Open Eye Blink Corrector"),
|
|
("/face_swapper/couple_swap_single/", "couple_swap_single/", "Couple Swap (Single Source Template)")
|
|
],
|
|
"Teeth_Whitener": [
|
|
("/teeth_whitener/image/", "image/", "Natural CIELAB Teeth Whitener"),
|
|
("/teeth_whitener/image_full/", "image_full/", "Full Aggressive Teeth Whitener")
|
|
],
|
|
"Blemish_Remover": [
|
|
("/blemish_remover/image/", "image/", "Blemish Remover, Eye Fix & Skin Improver"),
|
|
("/blemish_remover/improver/", "improver/", "Blemish Remover — Skin Improver & Eye Fix")
|
|
],
|
|
"Eye_Bag_Remover": [
|
|
("/eye_bag_remover/image/", "image/", "Under-Eye Bag & Dark Circle Remover")
|
|
],
|
|
"Eye_Redness_Remover": [
|
|
("/eye_redness_remover/image/", "image/", "Eye Redness & Flash Sclera Corrector")
|
|
],
|
|
"Face_Analyzer": [
|
|
("/skin_analyzer/analyze", "analyze", "Comprehensive AI Skin Health & Metrics Analyzer")
|
|
],
|
|
"Skin_Detection": [
|
|
("/skin_detection/image/", "image/", "Skin Detection & Mask Extractor")
|
|
],
|
|
"Sky_Detection": [
|
|
("/sky_detection/image/", "image/", "Sky Detection & Horizon Mask Extractor")
|
|
],
|
|
"Pose_Detection": [
|
|
("/pose_detection/image/", "image/", "MediaPipe & OpenPose Keypoint Detection")
|
|
],
|
|
"Cre_Face_With_Hair_Segment_Model": [
|
|
("/face_hair_segmentation/image/", "image/", "Dual Face & Hair Multi-Channel Segmentation")
|
|
],
|
|
"Cre_Hair_Detection_Segment_Model": [
|
|
("/hair_segmentation/image/", "image/", "High-Precision Hair Segmentation"),
|
|
("/hair_segmentation_yolo_sam/image/", "yolo_sam/", "Hair Segmentation YOLO + SAM")
|
|
],
|
|
"Stable_Diffusion_Hair_Segmentation": [
|
|
("/stable_diffusion_hair_segmentation/image/", "image/", "Stable Diffusion Hair Segmentation Router")
|
|
],
|
|
"Stable_Diffusion_Hair_Color_Changer_And_Hair_Style_Changer": [
|
|
("/flux_fill/hair_color_changer/image/", "hair_color_changer/", "FLUX.1-Fill Hair Color Changer (36 Presets)"),
|
|
("/flux_fill/hair_style_changer/image/", "hair_style_changer/", "FLUX.1-Fill Hair Style Changer (60 Presets)")
|
|
],
|
|
"Stable_Diffusion_Eye_Changer": [
|
|
("/flux_fill/eye_changer/image/", "image/", "FLUX.1-Fill Eye Color & Eyewear Inpainting")
|
|
],
|
|
"Flux_Dress_Changer": [
|
|
("/flux_fill/dress_changer/image/", "image/", "FLUX.1-Fill Wardrobe Restyling & Outfits")
|
|
],
|
|
"Flux_Couple_Dress_Changer": [
|
|
("/flux_fill/couple_dress_changer/image/", "image/", "FLUX.1-Fill Couple Outfits & Fashion")
|
|
],
|
|
"Stable_Diffusion_Headshot": [
|
|
("/flux/headshots/image1_1/", "image1_1/", "FLUX.1-Kontext Professional Studio Headshots")
|
|
],
|
|
"Stable_Diffusion_Head_Cartoon_Effects": [
|
|
("/flux/head_cartoon_effect/image/", "image/", "FLUX.1-Kontext Head Cartoon Effect")
|
|
],
|
|
"Stable_Diffusion_Modified_Head_Cartoon_Effects": [
|
|
("/flux/modified_head_cartoon_effects/image/", "image/", "FLUX.1-Kontext Modified Head Cartoon Effects")
|
|
],
|
|
"Stable_Diffusion_Comic_Coverpage_Generator": [
|
|
("/flux/comic_cover/image/", "image/", "FLUX.1-Kontext Comic Cover Art")
|
|
],
|
|
"Flux_Hairstyles": [
|
|
("/flux/hairstyles/image/", "image/", "FLUX.1-Kontext Hairstyles Inpainting")
|
|
],
|
|
"Flux_Sculpture_Effect": [
|
|
("/flux/sculptures/image/", "image/", "FLUX.1-Kontext Classical & Modern Sculpture Stylization")
|
|
],
|
|
"Flux_Silhouette_Effect": [
|
|
("/flux/silhouette/image/", "image/", "FLUX.1-Kontext Artistic Silhouette Maker")
|
|
],
|
|
"Flux_Glasses": [
|
|
("/flux/glasses_maker/image/", "image/", "FLUX.1-Kontext Eyewear & Sunglasses Stylizer")
|
|
],
|
|
"Flux_Cartoon": [
|
|
("/flux/cartoon/image/", "image/", "FLUX.1-Kontext Stylized Cartoon Effect")
|
|
],
|
|
"Flux_Background_Changer": [
|
|
("/flux/background_with_depth/image/", "image/", "FLUX.1-Kontext Background With Depth")
|
|
],
|
|
"Vintage_Look": [
|
|
("/flux/vintage_look/image/", "image/", "FLUX.1-Kontext Vintage Film & Retro Emulation")
|
|
],
|
|
"Stable_Diffusion_Text_To_Image_Model": [
|
|
("/sdxl/text_to_image/image/", "image/", "SDXL RealVisXL Text to Image Generation")
|
|
],
|
|
"Stable_Diffusion_Outpainting": [
|
|
("/sdxl/outpainting/image/", "image/", "SDXL RealVisXL Outpainting & Canvas Extender")
|
|
],
|
|
"Stable_Diffusion_Inpaint_Object_Replacer": [
|
|
("/sdxl/inpaint_object_replacer/image/", "image/", "SDXL Inpaint Object Replacer")
|
|
],
|
|
"Stable_Diffusion_Dress_Pattern": [
|
|
("/sdxl/dress_pattern/image/", "image/", "SDXL Dress Pattern & Fabric Inpainter")
|
|
],
|
|
"Stable_Diffusion_Blend_Collage": [
|
|
("/sdxl/blend_collage/image/", "image/", "SDXL RealVisXL Blend Collage")
|
|
],
|
|
"Stable_Diffusion_Dress_Replacer": [
|
|
("/sdxl/dress_replacer/image/", "image/", "SDXL RealVisXL Dress Replacer")
|
|
],
|
|
"Stable_Diffusion_Text_To_Cartoon_Character_Generator": [
|
|
("/sdxl/text_to_cartoon/image/", "image/", "SDXL Text to Cartoon Character Generator")
|
|
],
|
|
"Stable_Diffusion_Dress_Changer": [
|
|
("/dress-changer/image/", "image/", "ComfyUI Sapiens Skin-Seg Dress Changer")
|
|
],
|
|
"Stable_Diffusion_Text_To_Caricature": [
|
|
("/sdxl/text_to_caricature/image/", "image/", "SDXL Text to Caricature Generation")
|
|
],
|
|
"Stable_Diffusion_Face_Expressions_Changer": [
|
|
("/sdxl/expressions_changer/image/", "image/", "SDXL Facial Expressions Changer")
|
|
],
|
|
"Multi_Segmentation_Model": [
|
|
("/multi_segmentation_yolo_sam/image/", "image/", "ComfyUI Multi-Segmentation (YOLO + SAM)")
|
|
],
|
|
"Stable_Diffusion_Image_To_Image_Model": [
|
|
("/stable_diffusion/image/", "image/", "Stable Diffusion 1.5 General Inpainting")
|
|
],
|
|
"Stable_Diffusion_Realistic_Avatar": [
|
|
("/stable_diffusion_avatar_with_original_face/image/", "image/", "Avatar with Original Face (FaceID + Roop)")
|
|
],
|
|
"Cre_Cartoonify_Caricature_Effects_Model": [
|
|
("/cartoonify_caricature_effects/image/", "image/", "CartoonGAN & Anime Stylizer")
|
|
],
|
|
"Stable_Diffusion_Art_Style_Transfer": [
|
|
("/stable_diffusion_art_style_transfer/image/", "image/", "Fine-Art Style Transfer (Neural Style)")
|
|
],
|
|
"Stable_Diffusion_Reaslistic_Background_Changer": [
|
|
("/stable_diffusion_realistic_background_changer/image/", "image/", "Realistic Background Changer (SD1.5)")
|
|
],
|
|
"Stable_Diffusion_Silhouette_Maker": [
|
|
("/flux/silhouette/image/", "image/", "Silhouette & Shadow Profile Generator")
|
|
],
|
|
"Stable_Diffusion_Caricature_Effects": [
|
|
("/stable_diffusion_caricature_effects/image/", "image/", "Caricature Effects Pipeline")
|
|
],
|
|
"Stable_Diffusion_Comic_Generator": [
|
|
("/stable_diffusion_comic_generator/image/", "image/", "Comic Panel Generator")
|
|
],
|
|
"Stable_Diffusion_Photo_2_Caricature": [
|
|
("/stable_diffusion_photo_2_caricature/image/", "image/", "Photo to Caricature Converter")
|
|
],
|
|
"Stable_Diffusion_Caricature_Hair_Face_Effect": [
|
|
("/stable_diffusion_caricature_hair_face_effect/image/", "image/", "Caricature Hair & Face Effect")
|
|
],
|
|
"Caricature_Avatar": [
|
|
("/caricature_avatar/image/", "image/", "Caricature Avatar Composite Pipeline"),
|
|
("/caricature_avatar/image1/", "image1/", "Caricature Avatar — Couple Composite (image1)"),
|
|
("/caricature_avatar/single_couple_image/", "single_couple_image/", "Caricature Avatar — Single Source Couple Template")
|
|
],
|
|
"Polaroid_Effect": [
|
|
("/polaroid_effect/image/", "image/", "Vintage Polaroid Frame & Film Emulation")
|
|
],
|
|
"Stable_Diffusion_Relighter": [
|
|
("/relighting_effect/image/", "image/", "Neural Studio Relighting & Shadow Synthesizer")
|
|
],
|
|
"Stable_Diffusion_New_Cartoon Effects": [
|
|
("/stable_diffusion_new_cartoon_effects/image/", "image/", "New Cartoon Effects (Artistic Cel & Anime)")
|
|
],
|
|
"Stable_Diffusion_Artistic_Effects": [
|
|
("/stable_diffusion_artistic_effects/image/", "image/", "Artistic Effects with Gender Detection")
|
|
],
|
|
"Feedbacks": [
|
|
("/feedback/submit/", "submit/", "User Feedback & Model Quality Rating")
|
|
],
|
|
"Reports": [
|
|
("/reports/data/", "data/", "Bug Reports & Diagnostics Collector")
|
|
],
|
|
"Credits_Limit": [
|
|
("/credits/use", "credits/use", "Credits & Billing Client API"),
|
|
("/credits/admin/api/accounts", "credits/admin/api/accounts", "Credits Admin Portal & REST CRUD API")
|
|
],
|
|
"Trendy": [
|
|
("/trendy/image/", "image/", "Trendy AI Stylization Filter")
|
|
]
|
|
}
|
|
|
|
|
|
# Section metadata matching original EXACTLY
|
|
sections_meta = [
|
|
{
|
|
"id": "sec-flux-fill",
|
|
"key": "flux-fill",
|
|
"icon": "🎨",
|
|
"title": "FLUX.1-Fill Inpainting",
|
|
"tag": "Flow Matching Inpainting",
|
|
"port": "8003 (Backend: 8013)",
|
|
"lead": "FLUX.1-Fill-dev 12B flow-matching inpainting models specialized in precision portrait manipulation, multi-preset wardrobe restyling, hair color/style changing, and double exposure with automatic Sapiens segmentation.",
|
|
"hue": 268
|
|
},
|
|
{
|
|
"id": "sec-flux-kontext",
|
|
"key": "flux-kontext",
|
|
"icon": "⚡",
|
|
"title": "FLUX Kontext Stylization",
|
|
"tag": "Multi-Preset Kontext",
|
|
"port": "8000 (Kontext: 8012)",
|
|
"lead": "Style transfer and generative transformation using FLUX.1-dev contextual guidance. Supports dozens of verified aesthetic prompts for hairstyles, glasses, retro polaroid looks, sculptures, and 3D figurine caricatures.",
|
|
"hue": 335
|
|
},
|
|
{
|
|
"id": "sec-ml-models",
|
|
"key": "ml-models",
|
|
"icon": "👁️",
|
|
"title": "ML Vision Models",
|
|
"tag": "High-Throughput Vision",
|
|
"port": "8000",
|
|
"lead": "Dedicated discriminative and GAN-based computer vision microservices: Face restoration (CodeFormer), Super-Resolution (Real-ESRGAN), DeOldify colorization, LaMa object removal, P3M alpha matting, and sub-pixel facial landmark mesh extraction.",
|
|
"hue": 205
|
|
},
|
|
{
|
|
"id": "sec-comfyui",
|
|
"key": "comfyui",
|
|
"icon": "🧩",
|
|
"title": "ComfyUI Workflows",
|
|
"tag": "Headless Node Graphs",
|
|
"port": "8188",
|
|
"lead": "Headless ComfyUI workflow pipelines executing multi-stage node graphs. Combines YOLOv8 detection, SAM segmentation, and iterative inpainting with round-robin server routing for complex multi-garment wardrobe transformations.",
|
|
"hue": 28
|
|
},
|
|
{
|
|
"id": "sec-sd15",
|
|
"key": "sd15",
|
|
"icon": "✨",
|
|
"title": "Stable Diffusion 1.5",
|
|
"tag": "Latent Diffusion",
|
|
"port": "8000",
|
|
"lead": "Production fine-tuned SD 1.5 checkpoints for artistic styling, caricature generation, comic art, FaceID avatar synthesis, realistic background inpainting, and studio portrait relighting.",
|
|
"hue": 150
|
|
},
|
|
{
|
|
"id": "sec-sdxl",
|
|
"key": "sdxl",
|
|
"icon": "🚀",
|
|
"title": "SDXL RealVisXL Inpainting",
|
|
"tag": "Photorealistic Diffusion",
|
|
"port": "8000",
|
|
"lead": "High-resolution 1024x1024 inpainting with RealVisXL V5.0. Advanced prompt routing, garment pattern synthesis, canvas outpainting, expression modification, and seamless collage generation.",
|
|
"hue": 232
|
|
},
|
|
{
|
|
"id": "sec-other",
|
|
"key": "other",
|
|
"icon": "⚙️",
|
|
"title": "Credits, Reports & System",
|
|
"tag": "Gateway Infrastructure",
|
|
"port": "5925",
|
|
"lead": "Multi-tenant credit accounting, client feature billing authorization, asynchronous error diagnostic collection, user model quality telemetry, and cluster health liveness probes.",
|
|
"hue": 45
|
|
}
|
|
]
|
|
|
|
# Section mapping for each API
|
|
sec_by_key = {
|
|
# sec-flux-fill (hue: 268)
|
|
"Stable_Diffusion_Hair_Color_Changer_And_Hair_Style_Changer": "sec-flux-fill",
|
|
"Stable_Diffusion_Eye_Changer": "sec-flux-fill",
|
|
"Flux_Dress_Changer": "sec-flux-fill",
|
|
"Flux_Couple_Dress_Changer": "sec-flux-fill",
|
|
|
|
# sec-flux-kontext (hue: 335)
|
|
"Flux_Hairstyles": "sec-flux-kontext",
|
|
"Flux_Sculpture_Effect": "sec-flux-kontext",
|
|
"Flux_Silhouette_Effect": "sec-flux-kontext",
|
|
"Flux_Glasses": "sec-flux-kontext",
|
|
"Flux_Cartoon": "sec-flux-kontext",
|
|
"Flux_Background_Changer": "sec-flux-kontext",
|
|
"Vintage_Look": "sec-flux-kontext",
|
|
"Stable_Diffusion_Headshot": "sec-flux-kontext",
|
|
"Stable_Diffusion_Head_Cartoon_Effects": "sec-flux-kontext",
|
|
"Stable_Diffusion_Modified_Head_Cartoon_Effects": "sec-flux-kontext",
|
|
"Stable_Diffusion_Comic_Coverpage_Generator": "sec-flux-kontext",
|
|
|
|
# sec-ml-models (hue: 205)
|
|
"Cre_Aws_Waifu2x_Model": "sec-ml-models",
|
|
"Cre_Aws_Colorization_Model": "sec-ml-models",
|
|
"Cre_Aws_Old_Photo_Restore_Model": "sec-ml-models",
|
|
"Cre_Aws_Advance_Image_Segment_Anything_Dichotomous_Model": "sec-ml-models",
|
|
"Cre_Aws_cloth_segmentation_Model": "sec-ml-models",
|
|
"Cloth_Segmentation_Model_V2": "sec-ml-models",
|
|
"dress_segmentation_auto": "sec-ml-models",
|
|
"Cre_Aws_Lama_Cleaner_Model": "sec-ml-models",
|
|
"Cre_Aws_Background_Remover_Model": "sec-ml-models",
|
|
"Cre_Aws_Cartoon_Model": "sec-ml-models",
|
|
"Face_Coordinates": "sec-ml-models",
|
|
"Cre_Face_With_Hair_Segment_Model": "sec-ml-models",
|
|
"Cre_Cartoonify_Caricature_Effects_Model": "sec-ml-models",
|
|
"Cre_Hair_Detection_Segment_Model": "sec-ml-models",
|
|
"Stable_Diffusion_Hair_Segmentation": "sec-ml-models",
|
|
"Eye_Bag_Remover": "sec-ml-models",
|
|
"Skin_Detection": "sec-ml-models",
|
|
"Sky_Detection": "sec-ml-models",
|
|
"Pose_Detection": "sec-ml-models",
|
|
"Caricature_Avatar": "sec-ml-models",
|
|
"Teeth_Whitener": "sec-ml-models",
|
|
"Blemish_Remover": "sec-ml-models",
|
|
"Eye_Redness_Remover": "sec-ml-models",
|
|
"Polaroid_Effect": "sec-ml-models",
|
|
"Face_Swapper": "sec-ml-models",
|
|
"Stable_Diffusion_Relighter": "sec-ml-models",
|
|
"Face_Analyzer": "sec-ml-models",
|
|
"Trendy": "sec-ml-models",
|
|
|
|
# sec-comfyui (hue: 28)
|
|
"Multi_Segmentation_Model": "sec-comfyui",
|
|
"Stable_Diffusion_Dress_Changer": "sec-comfyui",
|
|
|
|
# sec-sd15 (hue: 150)
|
|
"Stable_Diffusion_Image_To_Image_Model": "sec-sd15",
|
|
"Stable_Diffusion_Realistic_Avatar": "sec-sd15",
|
|
"Stable_Diffusion_Art_Style_Transfer": "sec-sd15",
|
|
"Stable_Diffusion_Reaslistic_Background_Changer": "sec-sd15",
|
|
"Stable_Diffusion_Silhouette_Maker": "sec-sd15",
|
|
"Stable_Diffusion_Caricature_Effects": "sec-sd15",
|
|
"Stable_Diffusion_Comic_Generator": "sec-sd15",
|
|
"Stable_Diffusion_Photo_2_Caricature": "sec-sd15",
|
|
"Stable_Diffusion_Caricature_Hair_Face_Effect": "sec-sd15",
|
|
"Stable_Diffusion_New_Cartoon Effects": "sec-sd15",
|
|
"Stable_Diffusion_Artistic_Effects": "sec-sd15",
|
|
|
|
# sec-sdxl (hue: 232)
|
|
"Stable_Diffusion_Text_To_Image_Model": "sec-sdxl",
|
|
"Stable_Diffusion_Outpainting": "sec-sdxl",
|
|
"Stable_Diffusion_Inpaint_Object_Replacer": "sec-sdxl",
|
|
"Stable_Diffusion_Dress_Pattern": "sec-sdxl",
|
|
"Stable_Diffusion_Blend_Collage": "sec-sdxl",
|
|
"Stable_Diffusion_Dress_Replacer": "sec-sdxl",
|
|
"Stable_Diffusion_Text_To_Cartoon_Character_Generator": "sec-sdxl",
|
|
"Stable_Diffusion_Text_To_Caricature": "sec-sdxl",
|
|
"Stable_Diffusion_Face_Expressions_Changer": "sec-sdxl",
|
|
|
|
# sec-other (hue: 45)
|
|
"Credits_Limit": "sec-other",
|
|
"Feedbacks": "sec-other",
|
|
"Reports": "sec-other"
|
|
}
|
|
|
|
# Process each cred
|
|
processed_eps_by_sec = {sm["id"]: [] for sm in sections_meta}
|
|
|
|
for c in creds:
|
|
key = c["api_key"]
|
|
link = c["api_ip_link"]
|
|
sec_id = sec_by_key.get(key, "sec-ml-models")
|
|
|
|
routes = custom_mappings.get(key, [])
|
|
if not routes:
|
|
routes = [("/" + key.lower() + "/image/", "image/", key)]
|
|
|
|
# Build sub-endpoints
|
|
sub_eps = []
|
|
for orig_p, subp, desc_title in routes:
|
|
old_ep = get_ep(orig_p)
|
|
full_u = link.rstrip("/") + "/" + subp.lstrip("/")
|
|
|
|
if old_ep:
|
|
ep_dict = {
|
|
"id": old_ep.get("id", key.lower()),
|
|
"method": old_ep.get("method", "POST"),
|
|
"subpath": subp,
|
|
"full_url": full_u,
|
|
"path": old_ep.get("path", "/" + subp),
|
|
"title": desc_title or old_ep.get("title", key),
|
|
"summary": old_ep.get("summary", ""),
|
|
"desc": old_ep.get("desc", ""),
|
|
"params": old_ep.get("params", []),
|
|
"chips": old_ep.get("chips", []),
|
|
"resp": old_ep.get("resp", "image/png"),
|
|
"subs": old_ep.get("subs", []),
|
|
"curl": old_ep.get("curl", "")
|
|
}
|
|
else:
|
|
ep_dict = {
|
|
"id": "api-" + key.lower().replace("_", "-"),
|
|
"method": "POST",
|
|
"subpath": subp,
|
|
"full_url": full_u,
|
|
"path": "/" + subp,
|
|
"title": desc_title,
|
|
"summary": desc_title,
|
|
"desc": desc_title,
|
|
"params": [
|
|
{"n": "image", "al": "image0", "ty": "file (binary)", "lc": "multipart/form-data", "rq": True, "df": "None", "ds": "Input image file."},
|
|
{"n": "secretKey", "al": "", "ty": "string", "lc": "multipart/form-data", "rq": True, "df": "'abcdef'", "ds": "🔑 Authentication secret key."}
|
|
],
|
|
"chips": [],
|
|
"resp": "image/png",
|
|
"subs": [],
|
|
"curl": ""
|
|
}
|
|
sub_eps.append(ep_dict)
|
|
|
|
# Primary endpoint for this API
|
|
primary = sub_eps[0]
|
|
# Root API entry inside section.eps
|
|
api_ep = {
|
|
"id": "api-" + key.lower().replace("_", "-"),
|
|
"api_key": key,
|
|
"api_ip_link": link,
|
|
"title": key,
|
|
"method": "MULTI" if len(sub_eps) > 1 else primary["method"],
|
|
"path": primary["path"],
|
|
"full_url": primary["full_url"],
|
|
"port": primary.get("port", "8000"),
|
|
"resp": primary["resp"],
|
|
"summary": primary["summary"] or key,
|
|
"desc": primary["desc"] or primary["summary"] or key,
|
|
"params": primary["params"],
|
|
"chips": primary["chips"],
|
|
"subs": primary["subs"],
|
|
"curl": primary["curl"],
|
|
"endpoints": sub_eps
|
|
}
|
|
|
|
processed_eps_by_sec[sec_id].append(api_ep)
|
|
|
|
# Also add health check to sec-other
|
|
health_ep = get_ep("/health")
|
|
if health_ep:
|
|
processed_eps_by_sec["sec-other"].append({
|
|
"id": "other-health",
|
|
"api_key": "System_Health",
|
|
"api_ip_link": "http://localhost:5925/health",
|
|
"title": "System Health & Maintenance Check",
|
|
"method": "GET",
|
|
"path": "/health",
|
|
"full_url": "http://localhost:5925/health",
|
|
"port": "5925",
|
|
"resp": "application/json",
|
|
"summary": "Cluster health check monitoring GPU state, PostgreSQL database, and active services.",
|
|
"desc": "Liveness and readiness probe for load balancers. Checks database connectivity and active genre modules.",
|
|
"params": health_ep.get("params", []),
|
|
"chips": [],
|
|
"subs": [],
|
|
"curl": "curl http://localhost:5925/health",
|
|
"endpoints": [{
|
|
"id": "other-health",
|
|
"method": "GET",
|
|
"subpath": "health",
|
|
"full_url": "http://localhost:5925/health",
|
|
"path": "/health",
|
|
"title": "System Health Check",
|
|
"summary": "Liveness and readiness probe",
|
|
"desc": "Checks server health",
|
|
"params": health_ep.get("params", []),
|
|
"chips": [],
|
|
"resp": "application/json",
|
|
"subs": []
|
|
}]
|
|
})
|
|
|
|
# Construct final sections list
|
|
final_sections = []
|
|
for sm in sections_meta:
|
|
eps_list = processed_eps_by_sec[sm["id"]]
|
|
final_sections.append({
|
|
"id": sm["id"],
|
|
"key": sm["key"],
|
|
"icon": sm["icon"],
|
|
"title": sm["title"],
|
|
"tag": sm["tag"],
|
|
"lead": sm["lead"],
|
|
"port": sm["port"],
|
|
"hue": sm["hue"],
|
|
"eps": eps_list
|
|
})
|
|
|
|
output_data = {
|
|
"meta": {
|
|
"title": "FastAPI Generative AI Backend API Reference",
|
|
"heading": "Edit faces, hair and photos over plain HTTP.",
|
|
"baseUrl": "https://apigp0006.creinnovations.in",
|
|
"intro": "Complete interactive documentation for all 68 production AI services with full direct URLs, categorized multi-route endpoints, and verified preset codes.",
|
|
"authNote": "All inference endpoints authenticate using secretKey form-data parameter (default: 'abcdef')."
|
|
},
|
|
"sections": final_sections
|
|
}
|
|
|
|
with open("scratch/faithful_docs_data.json", "w") as f:
|
|
json.dump(output_data, f, indent=2)
|
|
|
|
print("Created scratch/faithful_docs_data.json successfully!")
|
|
for s in final_sections:
|
|
print(f"Section {s['id']} (hue={s['hue']}): {len(s['eps'])} APIs")
|