Skip to main content

Package for Using Segmind APIs in Python

Project description

Segmind API Wrapper

Wrapper for Segmind API for using Generative models. Visit Website

Installation

Simply Install the pip package by typing the following in the terminal:

pip install segmind

Usage

  • Import Required Model Class
           from segmindapi import Kadinsky
  • Instantite Model Class with your API Key
           model = Kadinsky(api_key)
  • Generate Image
           img = model.generate(prompt)
  • View Image
           img.show()

Models Supported

Check Available Models

ControlNet

Image to Image using Stable Diffusion 1.5.
Available Options:

  • Canny
  • Depth
  • OpenPose
  • Scribble
  • SoftEdge


from segmindapi import ControlNet
model = ControlNet(api_key)
img = model.generate(prompt, imageUrl, option)

For additional options, check Docstring of the model.

SD2_1

Text-to-image Stable diffusion 2.1 model that can generate images given a natural language prompt.
from segmindapi import SD2_1
model = SD2_1(api_key)
img = model.generate(prompt)

For additional options, check Docstring of the model.

Kadinsky

Image-to-image Kadinsky model that can generate images given a natural language prompt.
from segmindapi import Kadinsky
model = Kadinsky(api_key)
img = model.generate(prompt)

For additional options, check Docstring of the model.

SD1_5 Img2Img

A text-to-image diffusion model that can create photorealistic images from any given text input, and additionally has the ability to fill in missing parts of an image by using a mask.
from segmindapi import SD1_5

For additional options, check Docstring of the model.

ERSGAN

An image-to-image model that upscales low-resolution images into high-resolution ones using a GAN trained on a dataset of high-resolution images.
from segmindapi import ERSGAN

For additional options, check Docstring of the model.

BackgroundRemoval

The background removal model efficiently separates the main subject or the object from its surrounding background, resulting in a clean and isolated foreground.
from segmindapi import BackgroundRemoval

For additional options, check Docstring of the model.

Codeformer

CodeFormer is a robust face restoration algorithm for old photos or AI-generated faces.
from segmindapi import Codeformer

For additional options, check Docstring of the model.

SAM

Segment Anything Model (SAM) is a state-of-the-art image segmentation model that can segment any object in an image.
from segmindapi import SAM
model = SAM(api_key)
img = model.generate(imageUrl)

For additional options, check Docstring of the model.

FaceSwap

FaceSwap is a state-of-the-art face swapping model that can swap faces in images and videos.
from segmindapi import FaceSwap
model = FaceSwap(api_key)
img = model.generate(imageUrl, maskUrl)

For additional options, check Docstring of the model.

Examples

Model Code Example Generated Image
Kadinsky Kadinsky(api_key).generate("tiny isometric city on a tiny floating island, highly detailed, 3d render") image
Stable Diffusion v2.1 SD2_1(api_key).generate("calico cat wearing a cosmonaut suit, 3d render, pixar style, 8k, high resolution") image
Stable Diffusion img2img SD1_5(api_key).generate(prompt = "A fantasy landscape, trending on artstation, mystical sky", imageUrl= "https://segmind.com/sd-img2img-input.jpeg") image
Stable Diffusion Inpainting SD1_5(api_key).generate(prompt = "mecha robot sitting on a bench", imageUrl= "https://segmind.com/inpainting-input-image.jpeg", maskUrl= "https://segmind.com/inpainting-input-mask.jpeg") image
ControlNet Openpose ControlNet(api_key).generate(prompt = "a beautiful fashion model, wearing a red polka dress, red door background. hyperrealistic. photorealism, 4k, extremely detailed", imageUrl = "https://segmind.com/fashion2.jpeg", option="OpenPose") image
ControlNet Scribble ControlNet(api_key).generate(prompt = "steampunk underwater helmet, dark ocean background", imageUrl = "https://segmind.com/scribble-input.jpeg", option="Scribble") image
ControlNet Soft Edge ControlNet(api_key).generate(prompt = "royal chamber with fancy bed", imageUrl = "https://segmind.com/soft-edge-input.jpeg", option="SoftEdge") image
ControlNet Depth ControlNet(api_key).generate(prompt = "young african american man, black suit, smiling, white background", imageUrl = "https://segmind.com/depth.jpeg", option="Depth") image
ControlNet Canny ControlNet(api_key).generate(prompt = "a colorful bird, 4k", imageUrl = "https://segmind.com/canny-input.jpeg", option="Canny") image
Background Removal BackgroundRemoval(api_key).generate(imageUrl = "https://segmind.com/bg-removal.jpg") image
Face Swapper FaceSwap(api_key).generate(imageUrl = "https://segmind.com/elon.jpg", maskUrl = "https://segmind.com/burn.gif") image
Codeformer Codeformer(api_key).generate(imageUrl = "https://segmind.com/codeformer_input.png") image
ESRGAN ESRGAN(api_key).generate(imageUrl = "https://segmind.com/butterfly.png") image
SAM SAM(api_key).generate(imageUrl = "https://segmind.com/kitchen.jpg") image

Dependencies

  • PIL (Python Imaging Library)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

segmindapi-0.2.2.tar.gz (13.3 kB view details)

Uploaded Source

File details

Details for the file segmindapi-0.2.2.tar.gz.

File metadata

  • Download URL: segmindapi-0.2.2.tar.gz
  • Upload date:
  • Size: 13.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.15

File hashes

Hashes for segmindapi-0.2.2.tar.gz
Algorithm Hash digest
SHA256 21e445fcd8bf8094fb526c87843f2f10cddf16ab763146a26f2954c4db117606
MD5 cda38e8a862007fbfccdb70cf5641728
BLAKE2b-256 1292d18fe74697d1281de0ed6cbacc1750a8ca08b33d4e5a7e5cac35908bb958

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page