Package: leap-python-sdk
leap-python-sdkThe Official Leap APIRequirementsPython >=3.7Installingpipinstallleap-python-sdk==1.1.4Getting StartedfrompprintimportpprintfromleapimportLeap,ApiExceptionleap=Leap(# Defining the host is optional and defaults to https://api.tryleap.ai# See configuration.py for a list of all supported configuration parameters.host="https://api.tryleap.ai",# Configure Bearer authorization (JWT): beareraccess_token="YOUR_BEARER_TOKEN",)try:# Generate an Imagegenerate_response=leap.images.generate(prompt="A photo of an astronaut riding a horse",# requiredmodel_id="26a1a203-3a46-42cb-8cfa-f4de075907d8",# requirednegative_prompt="asymmetric, bad hands, bad hair",# optionalsteps=50,# optionalwidth=1024,# optionalheight=1024,# optionalnumber_of_images=1,# optionalprompt_strength=7,# optionalseed=4523184,# optionalwebhook_url="string_example",# optional)pprint(generate_response.body)pprint(generate_response.body["id"])pprint(generate_response.body["created_at"])pprint(generate_response.body["prompt"])pprint(generate_response.body["negative_prompt"])pprint(generate_response.body["seed"])pprint(generate_response.body["width"])pprint(generate_response.body["height"])pprint(generate_response.body["prompt_strength"])pprint(generate_response.body["number_of_images"])pprint(generate_response.body["state"])pprint(generate_response.body["status"])pprint(generate_response.body["steps"])pprint(generate_response.body["images"])pprint(generate_response.body["model_id"])pprint(generate_response.body["upscaling_option"])pprint(generate_response.headers)pprint(generate_response.status)pprint(generate_response.round_trip_time)exceptApiExceptionase:print("Exception when calling ImagesApi.generate:%s\n"%e)pprint(e.body)pprint(e.headers)pprint(e.status)pprint(e.reason)pprint(e.round_trip_time)Asyncasyncsupport is available by prependingato any method.importasynciofrompprintimportpprintfromleapimportLeap,ApiExceptionleap=Leap(# Defining the host is optional and defaults to https://api.tryleap.ai# See configuration.py for a list of all supported configuration parameters.host="https://api.tryleap.ai",# Configure Bearer authorization (JWT): beareraccess_token="YOUR_BEARER_TOKEN",)asyncdefmain():try:# Generate an Imagegenerate_response=awaitleap.images.agenerate(prompt="A photo of an astronaut riding a horse",# requiredmodel_id="26a1a203-3a46-42cb-8cfa-f4de075907d8",# requirednegative_prompt="asymmetric, bad hands, bad hair",# optionalsteps=50,# optionalwidth=1024,# optionalheight=1024,# optionalnumber_of_images=1,# optionalprompt_strength=7,# optionalseed=4523184,# optionalwebhook_url="string_example",# optional)pprint(generate_response.body)pprint(generate_response.body["id"])pprint(generate_response.body["created_at"])pprint(generate_response.body["prompt"])pprint(generate_response.body["negative_prompt"])pprint(generate_response.body["seed"])pprint(generate_response.body["width"])pprint(generate_response.body["height"])pprint(generate_response.body["prompt_strength"])pprint(generate_response.body["number_of_images"])pprint(generate_response.body["state"])pprint(generate_response.body["status"])pprint(generate_response.body["steps"])pprint(generate_response.body["images"])pprint(generate_response.body["model_id"])pprint(generate_response.body["upscaling_option"])pprint(generate_response.headers)pprint(generate_response.status)pprint(generate_response.round_trip_time)exceptApiExceptionase:print("Exception when calling ImagesApi.generate:%s\n"%e)pprint(e.body)pprint(e.headers)pprint(e.status)pprint(e.reason)pprint(e.round_trip_time)asyncio.run(main())Documentation for API EndpointsAll URIs are relative tohttps://api.tryleap.aiTagMethodHTTP requestDescriptionImagesgeneratePOST/api/v1/images/models/{modelId}/inferencesGenerate an ImageImagesdeleteDELETE/api/v1/images/models/{modelId}/inferences/{inferenceId}Delete Image JobImagesfind_oneGET/api/v1/images/models/{modelId}/inferences/{inferenceId}Get Single Image JobImageslist_allGET/api/v1/images/models/{modelId}/inferencesList All Image JobsImage Modelsdelete_modelDELETE/api/v2/images/models/{modelId}Delete a ModelImage Modelsget_modelGET/api/v2/images/models/{modelId}Get a Single ModelImage Modelslist_all_modelsGET/api/v2/images/modelsList All ModelsImage Modelstrain_modelPOST/api/v2/images/models/newTrain ModelMusicfind_oneGET/api/v1/music/{inferenceId}Get a Music Generation JobMusicgeneratePOST/api/v1/musicGenerate MusicMusiclist_allGET/api/v1/musicList Music Generation JobsDocumentation For ModelsCreateAndTrainModelDtoCreateAndTrainModelDtoImageSampleFilesCreateAndTrainModelDtoImageSampleUrlsCreateInferenceDtoCreateMusicgenInferenceDtoInferenceEntityInferenceImageEntityInferencesControllerFindAllResponseListModelsV2ResponseModelV2EntityModelV2EntityImageSamplesMusicControllerFindAllAudioResponseMusicgenInferenceEntityAuthorThis Python package is automatically generated byKonfig