Code Monkey home page Code Monkey logo

demo-automatic1111-sd-webui's Introduction

Banana Implementation

This repository is the implementation of stable-diffusion-webui

Endpoints

At the moment only one endpoint is implemented.

  • /txt2img is the implementation of stable-diffusion-webui /sdapi/v1/txt2img api.

    Json Input

    {
        "body": {
            "params": {
                "prompt": "CAT",
                "negative_prompt": "low quality",
                "steps": 25,
                "sampler_name": "Euler a",
                "cfg_scale": 7.5,
                "seed": 42,
                "batch_size": 1,
                "n_iter": 1,
                "width": 400,
                "height": 400,
                "tiling": 'false',
            }
        }
    }

    OUTPUT:

    {
        "output": "<base64 image>"
    }
  • img2img is the implementation of /sdapi/v1/img2img api

    JSON INPUT

    img2img_inputs = {
        "params": {
            "prompt": "blue banana",
            "negative_prompt": "cartoonish, low quality",
            "steps": 25,
            "sampler_name": "Euler a",
            "cfg_scale": 7.5,
            "denoising_strength": 0.7,
            "seed": 42,
            "batch_size": 1,
            "n_iter": 1,
            "width": 768,
            "height": 768,
            "tiling": "false",
            "init_images": [
                "b64images"
            ]
        }
    }
    

Client Implementation in Python

import banana_dev as client

my_model = client.Client(
    api_key="[API_KEY]",
    model_key="[MODEL_KEY]",
    url="[MODEL_URL]",
)

txt2img_inputs = {
    "params": {
        "prompt": "Nurse in scrub dress with her hair tied",
        "negative_prompt": "low quality",
        "steps": 25,
        "sampler_name": "Euler a",
        "cfg_scale": 7.5,
        "seed": 42,
        "batch_size": 1,
        "n_iter": 1,
        "width": 400,
        "height": 400,
        "tiling": "false",
    }
}

img2img_inputs = {
    "params": {
        "prompt": "blue banana",
        "negative_prompt": "cartoonish, low quality",
        "steps": 25,
        "sampler_name": "Euler a",
        "cfg_scale": 7.5,
        "denoising_strength": 0.7,
        "seed": 42,
        "batch_size": 1,
        "n_iter": 1,
        "width": 768,
        "height": 768,
        "tiling": "false",
        "init_images": [
            "b64images"
        ]
    }
}



txt2img_result, meta = my_model.call("/txt2img", txt2img_inputs)
img2img_result, meta = my_model.call("/img2img", img2img_inputs)

print(txt2img_inputs, img2img_result)

demo-automatic1111-sd-webui's People

Contributors

xuxant 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.