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 segmindapi
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.
SDOutpainting
The SDOutpainting model is used for outpainting tasks, where the model is given a part of an image and it needs to generate the rest of the image.
from segmindapi import SDOutpainting
model = SDOutpainting(api_key)
img = model.generate(imageUrl)
For additional options, check Docstring of the model.
Word2Img
A text-to-image model that can generate images from any given text input.
from segmindapi import Word2Img
model = Word2Img(api_key)
img = model.generate(image, prompt)
For additional options, check Docstring of the model.
QRGenerator
A QR code generator that can generate QR codes from any given text input.
from segmindapi import QRGenerator
model = QRGenerator(api_key)
img = model.generate(prompt, qr_text)
For additional options, check Docstring of the model.
Text To Image
We support several text to image models:
- Stable Diffusion XL 1.0
- Segmind Tiny-SD
- Segmind Tiny-SD (Portrait)
- Segmind Small-SD
- Paragon
- Realistic Vision
- Reliberate
- Revanimated
- Colorful
- Cartoon
- Edge of Realism
- Epic Realism
- RPG
- Scifi
- Cyber Realistic
- Samaritan
- RCNZ - Cartoon
- Manmarumix
- Majicmix
- Juggernaut Final
- Icbinp
- Fruit Fusion
- Flat 2d
- Fantassified Icons
- DvArch
- Dream Shaper
- Deep Spaced Diffusion
- Cute Rich Style
- All in one pixel
- 526mix
You can check the complete list of models here.
Examples
| Model | Code Example | Generated Image |
|---|---|---|
| Stable Diffusion XL | SDXL(api_key).generate(prompt = "cinematic film still, 4k, realistic, ((cinematic photo:1.3)) of panda wearing a blue spacesuit, sitting in a bar, Fujifilm XT3, long shot, ((low light:1.4)), ((looking straight at the camera:1.3)), upper body shot, somber, shallow depth of field, vignette, highly detailed, high budget Hollywood movie, bokeh, cinemascope, moody, epic, gorgeous, film grain, grainy") |
|
| Stable Diffusion Outpainting | SDOutpainting(api_key).generate(image = "https://www.segmind.com//image5.png", prompt = "streets in italy") |
|
| QR Generator | QRGenerator(api_key).generate(prompt = "A mouth-watering pizza topped with gooey cheese and fresh ingredients, Close-up, Realistic Style, Art Inspirations from Food Photography", qr_text = "www.segmind.com") |
|
| Word2Img | Word2Img(api_key).generate(image = "https://www.segmind.com//word2img_input.png", prompt = "top-view, A mouth-watering pizza topped with gooey cheese and fresh ingredients,Food Photography") |
|
| Kadinsky | Kadinsky(api_key).generate("tiny isometric city on a tiny floating island, highly detailed, 3d render") |
|
| Stable Diffusion v2.1 | SD2_1(api_key).generate("calico cat wearing a cosmonaut suit, 3d render, pixar style, 8k, high resolution") |
|
| 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") |
|
| 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") |
|
| 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") |
|
| ControlNet Scribble | ControlNet(api_key).generate(prompt = "steampunk underwater helmet, dark ocean background", imageUrl = "https://segmind.com/scribble-input.jpeg", option="Scribble") |
|
| ControlNet Soft Edge | ControlNet(api_key).generate(prompt = "royal chamber with fancy bed", imageUrl = "https://segmind.com/soft-edge-input.jpeg", option="SoftEdge") |
|
| ControlNet Depth | ControlNet(api_key).generate(prompt = "young african american man, black suit, smiling, white background", imageUrl = "https://segmind.com/depth.jpeg", option="Depth") |
|
| ControlNet Canny | ControlNet(api_key).generate(prompt = "a colorful bird, 4k", imageUrl = "https://segmind.com/canny-input.jpeg", option="Canny") |
|
| Background Removal | BackgroundRemoval(api_key).generate(imageUrl = "https://segmind.com/bg-removal.jpg") |
|
| Face Swapper | FaceSwap(api_key).generate(imageUrl = "https://segmind.com/elon.jpg", maskUrl = "https://segmind.com/burn.gif") |
|
| Codeformer | Codeformer(api_key).generate(imageUrl = "https://segmind.com/codeformer_input.png") |
|
| ESRGAN | ESRGAN(api_key).generate(imageUrl = "https://segmind.com/butterfly.png") |
|
| SAM | SAM(api_key).generate(imageUrl = "https://segmind.com/kitchen.jpg") |
Dependencies
- PIL (Python Imaging Library)
Metadata
Release files for segmindapi 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| segmindapi-0.3.0.tar.gz | 22.0 kB | Without provenance | Details for segmindapi-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| segmindapi-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for segmindapi-0.3.0-py3-none-any.whl |
Total release size: 63.6 kB
Release files / segmindapi-0.3.0.tar.gz
| Download URL | segmindapi-0.3.0.tar.gz |
|---|---|
| Size | 22.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
00184de32f5809fa25c75a34cfe6089bdf5a41badd4012fc2919cabc53b87d8e
|
|
BLAKE2b-256 checksum How to use checksums |
f65dec02915c767fedd7e9dbc022ccae5e4ae6aec3b46a21fbbbb46fa1cdcf50
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.15
|
Release files / segmindapi-0.3.0-py3-none-any.whl
| Download URL | segmindapi-0.3.0-py3-none-any.whl |
|---|---|
| Size | 41.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1d422d082c950ffc7b155e7c4950d0b1202b54a8b36793b321db036953bf6b33
|
|
BLAKE2b-256 checksum How to use checksums |
b9879c4471de0dbe1ea1ba129e9d1445c5eb1b4476b8194051968af1a2585a30
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.15
|
Security for segmindapi 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.