Coder Social home page Coder Social logo

pypixel's Introduction

pypixel

Build License Cohere OpenAI black

Pypixel is an NLP-powered code generation tool for image processing. With Pypixel, you can generate Python code snippets for a wide range of image processing tasks, such as applying filters, performing transformations, extracting features, and more. Harness the power of natural language prompts to automate image processing workflows effortlessly. Additionally, Pypixel enables you to generate new images from scratch and edit existing ones, allowing for creative experimentation and customization.

https://pypi.org/project/pypixelai/

Table of Contents

Features

  • Natural language code generation: Generate Python code snippets for image processing tasks using natural language prompts.
  • Image generation: Generate new images from scratch using natural language prompts.
  • Image editing: Edit existing images using natural language prompts.
  • Image processing: Perform a wide range of image processing tasks, such as applying filters, performing transformations, extracting features, and more.
  • Flexible APIs: Use Pypixel's APIs to integrate image processing into your own applications.

Installation

pip install pypixelai
vim .env # add your API key to the .env file . \

OPENAI_KEY="" 
COHERE_KEY=""
STARCODER_KEY="

Examples

  • Generate code snippets for image processing tasks
    from pypixelai import PyPixel # Import PyPixel
    from pypixelai.models import OpenAI # choose a model
    model = OpenAI()
    px = PyPixel(
          model
          #  debug=True       # print debug messages, default: False
          # retries=3        # number of times to retry code default=1
      )
    code = px(
          "Increase the brightness of the image by 50%",
          #  write_to_file="test_output.py",    # write code to file
          #  run_code=True,                     # run code
      )
      print(code)

Output:

import cv2
import numpy as np

img = cv2.imread('image.jpg')
img = np.int16(img)
img = img + (50/100)*img
img = np.clip(img, 0, 255)
img = np.uint8(img)
cv2.imwrite('image_brightened.jpg', img)
  • Generate new images from scratch

      model = OpenAI()  # choose a model
      px = PyPixel(model, retries=3)  # initialize PyPixel with the model
      urls = px.generate_images("Blank white image", num_images=2, download=True)
      print(urls)
  • Edit existing images

      image = open("image.jpg", "rb")
      mask = open("mask.png", "rb")
      prompt = "A sunlit indoor lounge area with a pool containing a flamingo"
      urls = px.edit_images(image, mask, prompt, n=None, size=None, download=False)
      print(urls)

Contributing

If you have any suggestions or would like to contribute in any way, please raise an issue.

License

This project is licensed under the MIT License.

pypixel's People

Contributors

navneetdesai avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.