Skip to main content

An interface for NVIDIA's gauGAN project that turns crude drawings into realistic images using AI.

Project description

gaugan.py

A Python package providing an interface to NVIDIA's gauGAN project (http://nvidia-research-mingyuliu.com/gaugan/), which turns crude drawings into realistic images using AI.

Installation

pip install gaugan

Usage

processImage(image = imageBytes, [style = 1], [url = 'http://12.34.56.78:90/'])

Returns a bytes object of the processed image in JPG format.

Parameters

image

A bytes object of a PNG image containing the drawing.

style (optional)

Valid values are 'random' or an integer. Default is 'random'.

url (optional)

An URL of a gauGAN server. Useful for bulk processing, as by default it gets a new URL every time processImage() is called. It is necessary because the URLs are changed periodically. You can get an URL from the getUrl() function.

Examples

Process image and display it using PIL
import gaugan, PIL, io
from PIL import Image

with open('input.png', "rb") as fh:
    image = processImage(fh.read())

PIL.Image.open(io.BytesIO(image)).show()
Process image and save it to disk
import gaugan

with open('input.png', "rb") as fh:
    image = gaugan.processImage(fh.read())

with open('output.jpg', "wb") as fh:
    fh.write(image)

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

gaugan-1.1.tar.gz (2.8 kB view details)

Uploaded Source

File details

Details for the file gaugan-1.1.tar.gz.

File metadata

  • Download URL: gaugan-1.1.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.53.0 CPython/3.8.6

File hashes

Hashes for gaugan-1.1.tar.gz
Algorithm Hash digest
SHA256 f67d2b2cb99615737af30b2531e7504131008ea84b7a6183de5591d8fc5e5b35
MD5 50eca92b7fe1b3012d34680be345619d
BLAKE2b-256 fb0081ccdaacde556036681a9fcd2e1cfb2261bc6be8e74c2df9ebe1010c5f04

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