prodia / fetch.py
Roman Baenro
Upload 2 files
ccc900d
import requests
def get_values():
resp = {"doc":{"metadata":{"image":[],"title":"","description":""},"api":{"method":"post","url":"","auth":"required","params":[],"results":{"codes":[]},"apiSetting":"63e152abae39c70076448b6f"},"swagger":{"path":"/job"},"next":{"description":"","pages":[]},"algolia":{"recordCount":1,"publishPending":False,"updatedAt":"2023-05-13T20:21:27.923Z"},"title":"Create a generation","icon":"","updates":[],"type":"endpoint","slug":"generate","excerpt":"Use this endpoint to start generating an image on Prodia.","body":"","order":0,"isReference":True,"deprecated":False,"hidden":False,"sync_unique":"generate","link_url":"","link_external":False,"previousSlug":"","slugUpdatedAt":"2023-02-06T19:16:54.830Z","revision":63,"_id":"63e152adae39c70076448b76","category":"63e152abae39c70076448b70","createdAt":"2023-02-06T19:19:09.122Z","updatedAt":"2023-07-05T20:56:55.881Z","parentDoc":"63ea65265e3b33000eda4124","project":"63def422013dd3004536bc06","version":{"version":"1.2","version_clean":"1.2.0","codename":"ImageGenie","is_stable":True,"is_beta":True,"is_hidden":False,"is_deprecated":False,"categories":["63def422013dd3004536bc0d","63def422013dd3004536bc0d","63def422013dd3004536bc0f","63def423013dd3004536bc17","63def4ab8570a300596ffa51","63e14c3d7db7ee005f65368e","63e152095cca0b02d7803f6b","63e1523e0de987044faf7119","63e1525b8f256f045a6ae39b","63e152abae39c70076448b70","63e28c3fb119180074e5a342","63e3c154fff713002b0b4b15","63e3c15ef6c1c5001e00a2a7","64020c652839760066ca3c5b"],"_id":"63def422013dd3004536bc0b","project":"63def422013dd3004536bc06","releaseDate":"2023-02-05T00:11:14.850Z","createdAt":"2023-02-05T00:11:14.850Z","__v":1},"__v":0,"isApi":True,"tutorials":[],"id":"63e152adae39c70076448b76"},"hideTOC":False,"meta":{"description":"Use this endpoint to start generating an image on Prodia.","hidden":False,"title":"Create a generation","type":"reference"},"oasDefinition":{"openapi":"3.0.3","info":{"title":"Prodia API","description":"Welcome to Prodia's API :)","termsOfService":"https://app.prodia.com/#/terms-of-service","contact":{"email":"hello@prodia.com"},"version":"1.2.0"},"servers":[{"url":"https://api.prodia.com/v1"}],"tags":[{"name":"Image Generation","description":"Image Generation API"}],"paths":{"/job":{"post":{"tags":["Image Generation"],"summary":"Create a generation","description":"Use this endpoint to start generating an image on Prodia.","operationId":"generate","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerateRequest"}}},"required":True},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Job"}}}},"400":{"description":"Invalid Generation Parameters"},"401":{"description":"Key Not Recognised"},"402":{"description":"API Access Not Enabled"}}}},"/transform":{"post":{"tags":["Image Generation"],"summary":"Transform an existing image","description":"Use this endpoint to do an 'img2img' style generation.","operationId":"transform","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransformRequest"}}},"required":True},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Job"}}}},"400":{"description":"Invalid Generation Parameters"},"401":{"description":"Key Not Recognised"},"402":{"description":"API Access Not Enabled"}}}},"/controlnet":{"post":{"tags":["Image Generation"],"summary":"[Coming soon] Create a Controlnet generation","description":"Use this endpoint to do a Controlnet generation.","operationId":"controlnet","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ControlNetRequest"}}},"required":True},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Job"}}}},"400":{"description":"Invalid Generation Parameters"},"401":{"description":"Key Not Recognised"},"402":{"description":"API Access Not Enabled"}}}},"/job/{jobId}":{"get":{"parameters":[{"in":"path","name":"jobId","schema":{"type":"string"},"required":True,"description":"ID of Job"}],"tags":["Image Generation"],"summary":"Retrieve a generation","description":"Get information about a generation job, including status.","operationId":"getJob","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Job"}}}},"401":{"description":"Key Not Recognised"},"402":{"description":"API Access Not Enabled"}}}}},"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-Prodia-Key"}},"schemas":{"Model":{"enum":["analog-diffusion-1.0.ckpt [9ca13f02]","anythingv3_0-pruned.ckpt [2700c435]","anything-v4.5-pruned.ckpt [65745d25]","AOM3A3_orangemixs.safetensors [9600da17]","deliberate_v2.safetensors [10ec4b29]","dreamlike-diffusion-1.0.safetensors [5c9fd6e0]","dreamlike-diffusion-2.0.safetensors [fdcf65e7]","dreamshaper_5BakedVae.safetensors [a3fbf318]","dreamshaper_6BakedVae.safetensors [114c8abb]","elldreths-vivid-mix.safetensors [342d9d26]","lyriel_v15.safetensors [65d547c5]","lyriel_v16.safetensors [68fceea2]","mechamix_v10.safetensors [ee685731]","meinamix_meinaV9.safetensors [2ec66ab0]","openjourney_V4.ckpt [ca2f377f]","portrait+1.0.safetensors [1400e684]","Realistic_Vision_V1.4-pruned-fp16.safetensors [8d21810b]","Realistic_Vision_V2.0.safetensors [79587710]","revAnimated_v122.safetensors [3f4fefd9]","riffusion-model-v1.ckpt [3aafa6fe]","sdv1_4.ckpt [7460a6fa]","v1-5-pruned-emaonly.ckpt [81761151]","shoninsBeautiful_v10.safetensors [25d8c546]","theallys-mix-ii-churned.safetensors [5d9225a4]","timeless-1.0.ckpt [7c4971d4]"]},"ControlnetModel":{"enum":["control_v11p_sd15_softedge [a8575a2a]","control_v11p_sd15_mlsd [aca30ff0]","control_v11e_sd15_ip2p [c4bb465c]","control_v11p_sd15_seg [e1f51eb9]","control_v11p_sd15_inpaint [ebff9138]","control_v11p_sd15s2_lineart_anime [3825e83e]","control_v11e_sd15_shuffle [526bfdae]","control_v11p_sd15_canny [d14c016b]","control_v11p_sd15_lineart [43d4be0d]","control_v11p_sd15_normalbae [316696f1]","control_v11f1p_sd15_depth [cfd03158]","control_v11p_sd15_openpose [cab727d4]","control_v11f1e_sd15_tile [a371b31b]","control_v11p_sd15_scribble [d4ba51ff]"]},"Sampler":{"enum":["Euler","Euler a","Heun","DPM++ 2M Karras","DDIM"]},"Job":{"type":"object","properties":{"job":{"type":"string","example":"xxxx-xxxx-xxxx-xxxx","description":"Job ID"},"params":{"type":"object","example":"{}","description":"Job Generation Params"},"status":{"enum":["queued","generating","failed","succeeded"]},"imageUrl":{"type":"string","description":"Direct URL to generated image"}}},"GenerateRequest":{"type":"object","required":["prompt"],"properties":{"model":{"$ref":"#/components/schemas/Model"},"prompt":{"type":"string","example":"puppies in a cloud, 4k","description":"Image Prompt"},"negative_prompt":{"type":"string","example":"badly drawn","description":"Negative Image Prompt"},"steps":{"type":"number","example":25,"description":"Steps"},"cfg_scale":{"type":"number","example":7,"description":"CFG Scale"},"seed":{"type":"number","example":-1,"description":"Seed"},"upscale":{"type":"boolean","example":False,"description":"Enable 2x Upscale"},"sampler":{"$ref":"#/components/schemas/Sampler"},"aspect_ratio":{"enum":["square","portrait","landscape"]}}},"TransformRequest":{"type":"object","required":["prompt","imageUrl"],"properties":{"imageUrl":{"type":"string","example":"https://example.com/image.png","description":"Input Image URL"},"model":{"$ref":"#/components/schemas/Model"},"prompt":{"type":"string","example":"puppies in a cloud, 4k","description":"Image Prompt"},"denoising_strength":{"type":"number","example":0.7,"description":"Strength of image transfomation"},"negative_prompt":{"type":"string","example":"badly drawn","description":"Negative Image Prompt"},"steps":{"type":"number","example":25,"description":"Steps"},"cfg_scale":{"type":"number","example":7,"description":"CFG Scale"},"seed":{"type":"number","example":-1,"description":"Seed"},"upscale":{"type":"boolean","example":False,"description":"Enable 2x Upscale"},"sampler":{"$ref":"#/components/schemas/Sampler"}}},"ControlNetRequest":{"type":"object","required":["prompt","imageUrl"],"properties":{"imageUrl":{"type":"string","example":"https://example.com/image.png","description":"Input Image URL"},"controlnet_model":{"$ref":"#/components/schemas/ControlnetModel"},"prompt":{"type":"string","example":"puppies in a cloud, 4k","description":"Image Prompt"},"negative_prompt":{"type":"string","example":"badly drawn","description":"Negative Image Prompt"},"steps":{"type":"number","example":25,"description":"Steps"},"cfg_scale":{"type":"number","example":7,"description":"CFG Scale"},"seed":{"type":"number","example":-1,"description":"Seed"},"sampler":{"$ref":"#/components/schemas/Sampler"}}}}},"security":[{"ApiKeyAuth":[]}],"x-readme":{"explorer-enabled":True,"proxy-enabled":True,"samples-enabled":True},"_id":"63e152abae39c70076448b6f"},"oasPublicUrl":"@prodia/v1.2#edaualjq791p4","oauth":True,"loginUrl":"https://app.prodia.com/api","suggestedEdits":True}
return [resp["oasDefinition"]["components"]["schemas"]['Model']['enum'], resp["oasDefinition"]["components"]["schemas"]['Sampler']['enum']]