GithubHelp home page GithubHelp logo

segmind-npm's Introduction

PyPI - Python Version GitHub Workflow Status (event) GitHub Workflow Status (event) PyPI - Downloads PyPI GitHub tag (latest SemVer)

Installation

pip3 install -r requirements.txt

Code style

Python

We adopt PEP8 as the preferred code style.

We use the following tools for linting and formatting:

Style configurations of yapf and isort can be found in setup.cfg.

We use pre-commit hook that checks and formats for flake8, yapf, isort, trailing whitespaces, fixes end-of-files, sorts requirments.txt automatically on every commit. The config for a pre-commit hook is stored in .pre-commit-config.

After you clone the repository, you will need to install initialize pre-commit hook.

pip install -U pre-commit

From the repository folder

pre-commit install

After this on every commit check code linters and formatter will be enforced.

Run locally

cd .

pip install virtualenv

virtualenv venv

source ./venv/bin/activate

pip install -r requirements.txt pip install -e .

segmind-npm's People

Contributors

agauravdev avatar pratyush-udhani avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

cruxcoder7

segmind-npm's Issues

Add `responseType: "stream"` to the POST request of the EsrGan API

return axios({
  url: this.url,
  data: JSON.stringify(data),
  method: "post",
  responseType: "stream",
  headers: {
    "Access-Control-Allow-Origin": "*",
    "Content-Type": "application/json",
    "x-api-key": `${this.apiKey}`,
   },
})

The data returned by the API is in a binary string format.

Adding responseType: "stream" makes the return type as an object. This helps in parsing the response and downloading the image returned by the API by calling the pipe().

export const EnhanceImage = async (image: string) => {
  esr.generate({
      image,
    })
    .then((response) => {
      if (response.status === 200) {
        const saveDirectory = "./enhanced_images"
        const fileName = 'downloaded_image.jpg'

        if (!fs.existsSync(saveDirectory)) {
          fs.mkdirSync(saveDirectory, { recursive: true })
        }

        const filePath = path.join(saveDirectory, fileName)

        const writer = fs.createWriteStream(filePath)
        response.data.pipe(writer)

        return new Promise((resolve, reject) => {
          writer.on("finish", resolve)
          writer.on("error", reject)
        })
      }
    })
    .catch((err) => console.log(err))
}

Vega & VegaRT Clents

When can we expect Vega & VegaRT Clients to be added to this SDK?

Thanks in advance

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.