GithubHelp home page GithubHelp logo

gradientsurfer / draw2img Goto Github PK

View Code? Open in Web Editor NEW
233.0 5.0 17.0 34.85 MB

A simple web UI for interactive text-guided image to image generation, intended for any age and skill level.

License: MIT License

Dockerfile 1.25% Python 26.86% JavaScript 1.35% TypeScript 17.58% HTML 2.52% Vue 50.35% CSS 0.09%
canvas img2img paint sdxl-turbo stable-diffusion txt2img web-ui ai-art

draw2img's Introduction

Draw2Img

A simple web UI for interactive text-guided image to image generation, intended for any age and skill level.

Community Showcase

"ocean wave, sunset, rays of light, photograph, 35mm digital, 4k"

ocean wave, sunset, rays of light, photograph, 35mm digital, 4k

Did you make something cool with Draw2Img? Showcase your artwork here!

Features

  • web based UI, interactive canvas with basic paint tool & color picker
  • real-time text-guided image to image generation via SDXL-Turbo (512 x 512 pixels)
  • editable prompt, seed, steps, and strength parameters
  • export button to save input and output images as PNG files, along with the parameters as JSON
  • multi-threaded server supports multiple concurrent users
    • easy to host on your LAN for creative fun with family and friends
  • local (no internet required), private, & open source

Requirements

Hardware:

  • GPU with at least 10 GB VRAM is recommended, but not strictly required
  • CPU only environments are supported but image generation will be significantly slower

Operating System:

  • Linux, Mac, or Windows

Software:

  • Python >= 3.10 and <= 3.11

Browser:

  • any modern browser (Firefox, Chrome, Edge, Safari, etc)

Internet:

  • not required (except to download the model once on first run)

Usage

Install

Clone this repository

git clone https://github.com/GradientSurfer/Draw2Img.git

Install the dependencies

pip install .

Start Server

Start the server, by default it will listen on http://localhost:8080

python draw2img/main.py

Navigate to the HTTP URL via your browser, and...that's it, have fun!

Options

You can host the server on a specific interface and port via the --host and --port options. For example to listen on 192.168.1.123:4269:

python draw2img/main.py --host 192.168.1.123 --port 4269

To see all available options

python draw2img/main.py --help

Container (Docker/Podman)

You can use the provided Dockerfile to build and run a container image:

DOCKER_BUILDKIT=1 docker build -t draw2img .

Be sure to mount your huggingface cache directory to avoid downloading the SDXL-Turbo model every time the container starts (-v ~/.cache/huggingface:/root/.cache/huggingface). To use GPU(s) you'll need the --gpus all option.

docker run -it -p 8080:8080 -p 8079:8079 -v ~/.cache/huggingface:/root/.cache/huggingface --gpus all draw2img

Development

Server

Install the Python package in editable mode

pip install -e .

UI

The UI can be built manually (static files are output to dist folder)

cd draw2img/ui
npm run build

Or alternatively, the Vue 3 template comes with a file server & hot reloading for easy development

npm run dev

Container (Docker/Podman)

You can avoid installing node and npm on your host machine by using a container image that already includes the UI toolchain (node:lts-slim).

cd draw2img/ui
# build the UI
docker run -it -v $(pwd):/ui -p 5173:5173 node:lts-slim bash -c "cd ui && npm run build"
# or run the dev server
docker run -it -v $(pwd):/ui -p 5173:5173 node:lts-slim bash -c "cd ui && npm run dev -- --host"

Design Notes

The backend is a multi-threaded Python websocket server, that also serves the static files for the web UI.

The front-end is a JS/TS application (Vue 3) bootstrapped via npm create vue@latest. The build produces static files that can be served with any web server software.

Performance

Although the websocket server is multi-threaded, a mutex protects the singleton Pipeline object because it is not thread safe. This means image generation is effectively single threaded, so performance scales poorly as the number of concurrent users increases, and CPU/GPU resources may be underutilized. Additionally, there is no batching of requests for inference, mainly due to the lack of underlying support for varying certain parameters (such as strength and steps) across samples within a single batch.

In practice the multithreading/lock primitives exhibit a degree of fairness, so limited CPU/GPU resources appear to be shared relatively evenly among concurrent users, even as incoming requests queue up. Technically though, Python doesn't make any guarantees regarding the order of thread scheduling when a lock is contended (according to the docs).

If you need additional concurrency and have available RAM/VRAM + compute, consider starting multiple instances of the draw2img process.

Security

This code has not been audited for vulnerabilities.

Contributions

Contributions are welcome! Please keep in mind the ethos of this project when opening PRs or issues.

Safety

There is no safety filter to prevent offensive or undesireable images from being generated, please use discretion. Supervise children as usual with any computer/internet use.

Non-goals / Other Projects

If you're an advanced user looking for more functionality, other projects like Stable Diffusion Web UI or ComfyUI may fit your needs better.

License

MIT

See the Stability AI Non-Commercial License for SDXL-Turbo and their acceptable use policy.

Star History

Star History Chart

draw2img's People

Contributors

gradientsurfer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

draw2img's Issues

`ModuleNotFoundError: No module named 'torch'`

Seems like a declared dependency is missing? ๐Ÿค” Looks like a really neat project!

Draw2Img on โคด main (4df6dad) is ๐Ÿ“ฆ v0.0.1 via ๐Ÿ v3.10.2 on โ˜๏ธ
14:35:03 $ virtualenv .venv
created virtual environment CPython3.12.0.final.0-64 in 619ms
  creator CPython3macOsBrew(dest=/Users/tim_vergenz/code/Draw2Img/.venv, clear=False, no_vcs_ignore=False, global=False)
  seeder FromAppData(download=False, pip=bundle, via=copy, app_data_dir=/Users/tim_vergenz/Library/Application Support/virtualenv)
    added seed packages: pip==23.3.1
  activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator

Draw2Img on โคด main (4df6dad) is ๐Ÿ“ฆ v0.0.1 via ๐Ÿ v3.10.2 on โ˜๏ธ   took 3s
14:35:14 $ source .venv/bin/activate.fish

Draw2Img on โคด main (4df6dad) is ๐Ÿ“ฆ v0.0.1 via ๐Ÿ v3.12.0 (.venv) on โ˜๏ธ
14:35:17 $

Draw2Img on โคด main (4df6dad) is ๐Ÿ“ฆ v0.0.1 via ๐Ÿ v3.12.0 (.venv) on โ˜๏ธ
14:35:18 $ pip install .
Processing /Users/tim_vergenz/code/Draw2Img
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting accelerate (from draw2img==0.0.1)
  Downloading accelerate-0.26.1-py3-none-any.whl.metadata (18 kB)
Collecting diffusers (from draw2img==0.0.1)
  Downloading diffusers-0.25.0-py3-none-any.whl.metadata (19 kB)
Collecting fire (from draw2img==0.0.1)
  Downloading fire-0.5.0.tar.gz (88 kB)
     โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 88.3/88.3 kB 2.2 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting numpy (from draw2img==0.0.1)
  Downloading numpy-1.26.3-cp312-cp312-macosx_10_9_x86_64.whl.metadata (61 kB)
     โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 61.2/61.2 kB 4.6 MB/s eta 0:00:00
Collecting pillow (from draw2img==0.0.1)
  Downloading pillow-10.2.0-cp312-cp312-macosx_10_10_x86_64.whl.metadata (9.7 kB)
Collecting pydantic (from draw2img==0.0.1)
  Downloading pydantic-2.5.3-py3-none-any.whl.metadata (65 kB)
     โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 65.6/65.6 kB 6.6 MB/s eta 0:00:00
Collecting safetensors (from draw2img==0.0.1)
  Downloading safetensors-0.4.1-cp312-cp312-macosx_10_7_x86_64.whl.metadata (3.8 kB)
Collecting transformers (from draw2img==0.0.1)
  Downloading transformers-4.36.2-py3-none-any.whl.metadata (126 kB)
     โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 126.8/126.8 kB 8.3 MB/s eta 0:00:00
Collecting websockets (from draw2img==0.0.1)
  Downloading websockets-12.0-cp312-cp312-macosx_10_9_x86_64.whl.metadata (6.6 kB)
Collecting packaging>=20.0 (from accelerate->draw2img==0.0.1)
  Using cached packaging-23.2-py3-none-any.whl.metadata (3.2 kB)
Collecting psutil (from accelerate->draw2img==0.0.1)
  Downloading psutil-5.9.7-cp36-abi3-macosx_10_9_x86_64.whl.metadata (21 kB)
Collecting pyyaml (from accelerate->draw2img==0.0.1)
  Using cached PyYAML-6.0.1-cp312-cp312-macosx_10_9_x86_64.whl.metadata (2.1 kB)
INFO: pip is looking at multiple versions of accelerate to determine which version is compatible with other requirements. This could take a while.
Collecting accelerate (from draw2img==0.0.1)
  Downloading accelerate-0.26.0-py3-none-any.whl.metadata (18 kB)
  Downloading accelerate-0.25.0-py3-none-any.whl.metadata (18 kB)
  Downloading accelerate-0.24.1-py3-none-any.whl.metadata (18 kB)
  Downloading accelerate-0.24.0-py3-none-any.whl.metadata (18 kB)
  Downloading accelerate-0.23.0-py3-none-any.whl.metadata (18 kB)
  Downloading accelerate-0.22.0-py3-none-any.whl.metadata (17 kB)
  Downloading accelerate-0.21.0-py3-none-any.whl.metadata (17 kB)
INFO: pip is still looking at multiple versions of accelerate to determine which version is compatible with other requirements. This could take a while.
  Downloading accelerate-0.20.3-py3-none-any.whl.metadata (17 kB)
  Downloading accelerate-0.20.2-py3-none-any.whl.metadata (17 kB)
  Downloading accelerate-0.20.1-py3-none-any.whl.metadata (17 kB)
  Downloading accelerate-0.20.0-py3-none-any.whl.metadata (17 kB)
  Downloading accelerate-0.19.0-py3-none-any.whl (219 kB)
     โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 219.1/219.1 kB 11.1 MB/s eta 0:00:00
INFO: This is taking longer than usual. You might need to provide the dependency resolver with stricter constraints to reduce runtime. See https://pip.pypa.io/warnings/backtracking for guidance. If you want to abort this run, press Ctrl + C.
  Downloading accelerate-0.18.0-py3-none-any.whl (215 kB)
     โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 215.3/215.3 kB 11.3 MB/s eta 0:00:00
  Downloading accelerate-0.17.1-py3-none-any.whl (212 kB)
     โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 212.8/212.8 kB 12.6 MB/s eta 0:00:00
  Downloading accelerate-0.17.0-py3-none-any.whl (212 kB)
     โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 212.8/212.8 kB 9.7 MB/s eta 0:00:00
  Downloading accelerate-0.16.0-py3-none-any.whl (199 kB)
     โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 199.7/199.7 kB 10.7 MB/s eta 0:00:00
  Downloading accelerate-0.15.0-py3-none-any.whl (191 kB)
     โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 191.5/191.5 kB 11.6 MB/s eta 0:00:00
  Downloading accelerate-0.14.0-py3-none-any.whl (175 kB)
     โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 176.0/176.0 kB 11.8 MB/s eta 0:00:00
  Downloading accelerate-0.13.2-py3-none-any.whl (148 kB)
     โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 148.8/148.8 kB 9.9 MB/s eta 0:00:00
  Downloading accelerate-0.13.1-py3-none-any.whl (148 kB)
     โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 148.8/148.8 kB 10.4 MB/s eta 0:00:00
  Downloading accelerate-0.13.0-py3-none-any.whl (148 kB)
     โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 148.8/148.8 kB 9.6 MB/s eta 0:00:00
  Downloading accelerate-0.12.0-py3-none-any.whl (143 kB)
     โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 144.0/144.0 kB 9.5 MB/s eta 0:00:00
  Downloading accelerate-0.11.0-py3-none-any.whl (123 kB)
     โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 123.1/123.1 kB 10.5 MB/s eta 0:00:00
  Downloading accelerate-0.10.0-py3-none-any.whl (117 kB)
     โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 117.1/117.1 kB 7.4 MB/s eta 0:00:00
  Downloading accelerate-0.9.0-py3-none-any.whl (106 kB)
     โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 106.8/106.8 kB 7.1 MB/s eta 0:00:00
  Downloading accelerate-0.8.0-py3-none-any.whl (114 kB)
     โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 114.5/114.5 kB 8.1 MB/s eta 0:00:00
  Downloading accelerate-0.7.1-py3-none-any.whl (79 kB)
     โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 79.9/79.9 kB 7.8 MB/s eta 0:00:00
  Downloading accelerate-0.7.0-py3-none-any.whl (79 kB)
     โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 79.8/79.8 kB 7.9 MB/s eta 0:00:00
  Downloading accelerate-0.6.2-py3-none-any.whl (65 kB)
     โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 65.9/65.9 kB 4.4 MB/s eta 0:00:00
  Downloading accelerate-0.6.1-py3-none-any.whl (65 kB)
     โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 65.9/65.9 kB 6.3 MB/s eta 0:00:00
  Downloading accelerate-0.6.0-py3-none-any.whl (65 kB)
     โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 65.8/65.8 kB 4.1 MB/s eta 0:00:00
  Downloading accelerate-0.5.1-py3-none-any.whl (58 kB)
     โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 58.0/58.0 kB 4.5 MB/s eta 0:00:00
  Downloading accelerate-0.5.0-py3-none-any.whl (57 kB)
     โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 58.0/58.0 kB 6.8 MB/s eta 0:00:00
  Downloading accelerate-0.4.0-py3-none-any.whl (55 kB)
     โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 55.3/55.3 kB 6.1 MB/s eta 0:00:00
  Downloading accelerate-0.3.0-py3-none-any.whl (49 kB)
     โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 50.0/50.0 kB 5.3 MB/s eta 0:00:00
  Downloading accelerate-0.2.1-py3-none-any.whl (47 kB)
     โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 47.3/47.3 kB 3.7 MB/s eta 0:00:00
  Downloading accelerate-0.2.0-py3-none-any.whl (47 kB)
     โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 47.3/47.3 kB 3.1 MB/s eta 0:00:00
  Downloading accelerate-0.1.0-py3-none-any.whl (34 kB)
  Downloading accelerate-0.0.1-py3-none-any.whl (5.7 kB)
Collecting importlib-metadata (from diffusers->draw2img==0.0.1)
  Downloading importlib_metadata-7.0.1-py3-none-any.whl.metadata (4.9 kB)
Collecting filelock (from diffusers->draw2img==0.0.1)
  Using cached filelock-3.13.1-py3-none-any.whl.metadata (2.8 kB)
Collecting huggingface-hub>=0.19.4 (from diffusers->draw2img==0.0.1)
  Downloading huggingface_hub-0.20.2-py3-none-any.whl.metadata (12 kB)
Collecting regex!=2019.12.17 (from diffusers->draw2img==0.0.1)
  Downloading regex-2023.12.25-cp312-cp312-macosx_10_9_x86_64.whl.metadata (40 kB)
     โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 40.9/40.9 kB 3.2 MB/s eta 0:00:00
Collecting requests (from diffusers->draw2img==0.0.1)
  Downloading requests-2.31.0-py3-none-any.whl.metadata (4.6 kB)
Collecting six (from fire->draw2img==0.0.1)
  Downloading six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting termcolor (from fire->draw2img==0.0.1)
  Downloading termcolor-2.4.0-py3-none-any.whl.metadata (6.1 kB)
Collecting annotated-types>=0.4.0 (from pydantic->draw2img==0.0.1)
  Using cached annotated_types-0.6.0-py3-none-any.whl.metadata (12 kB)
Collecting pydantic-core==2.14.6 (from pydantic->draw2img==0.0.1)
  Downloading pydantic_core-2.14.6-cp312-cp312-macosx_10_7_x86_64.whl.metadata (6.5 kB)
Collecting typing-extensions>=4.6.1 (from pydantic->draw2img==0.0.1)
  Downloading typing_extensions-4.9.0-py3-none-any.whl.metadata (3.0 kB)
Collecting tokenizers<0.19,>=0.14 (from transformers->draw2img==0.0.1)
  Downloading tokenizers-0.15.0-cp312-cp312-macosx_10_7_x86_64.whl.metadata (6.7 kB)
Collecting tqdm>=4.27 (from transformers->draw2img==0.0.1)
  Downloading tqdm-4.66.1-py3-none-any.whl.metadata (57 kB)
     โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 57.6/57.6 kB 5.2 MB/s eta 0:00:00
Collecting fsspec>=2023.5.0 (from huggingface-hub>=0.19.4->diffusers->draw2img==0.0.1)
  Downloading fsspec-2023.12.2-py3-none-any.whl.metadata (6.8 kB)
Collecting zipp>=0.5 (from importlib-metadata->diffusers->draw2img==0.0.1)
  Downloading zipp-3.17.0-py3-none-any.whl.metadata (3.7 kB)
Collecting charset-normalizer<4,>=2 (from requests->diffusers->draw2img==0.0.1)
  Downloading charset_normalizer-3.3.2-cp312-cp312-macosx_10_9_x86_64.whl.metadata (33 kB)
Collecting idna<4,>=2.5 (from requests->diffusers->draw2img==0.0.1)
  Downloading idna-3.6-py3-none-any.whl.metadata (9.9 kB)
Collecting urllib3<3,>=1.21.1 (from requests->diffusers->draw2img==0.0.1)
  Downloading urllib3-2.1.0-py3-none-any.whl.metadata (6.4 kB)
Collecting certifi>=2017.4.17 (from requests->diffusers->draw2img==0.0.1)
  Downloading certifi-2023.11.17-py3-none-any.whl.metadata (2.2 kB)
Downloading diffusers-0.25.0-py3-none-any.whl (1.8 MB)
   โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 1.8/1.8 MB 12.5 MB/s eta 0:00:00
Downloading safetensors-0.4.1-cp312-cp312-macosx_10_7_x86_64.whl (440 kB)
   โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 440.8/440.8 kB 10.1 MB/s eta 0:00:00
Downloading numpy-1.26.3-cp312-cp312-macosx_10_9_x86_64.whl (20.3 MB)
   โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 20.3/20.3 MB 13.2 MB/s eta 0:00:00
Downloading pillow-10.2.0-cp312-cp312-macosx_10_10_x86_64.whl (3.5 MB)
   โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 3.5/3.5 MB 13.9 MB/s eta 0:00:00
Downloading pydantic-2.5.3-py3-none-any.whl (381 kB)
   โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 381.9/381.9 kB 8.2 MB/s eta 0:00:00
Downloading pydantic_core-2.14.6-cp312-cp312-macosx_10_7_x86_64.whl (1.9 MB)
   โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 1.9/1.9 MB 13.7 MB/s eta 0:00:00
Downloading transformers-4.36.2-py3-none-any.whl (8.2 MB)
   โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 8.2/8.2 MB 14.1 MB/s eta 0:00:00
Downloading websockets-12.0-cp312-cp312-macosx_10_9_x86_64.whl (121 kB)
   โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 121.3/121.3 kB 4.2 MB/s eta 0:00:00
Using cached annotated_types-0.6.0-py3-none-any.whl (12 kB)
Downloading huggingface_hub-0.20.2-py3-none-any.whl (330 kB)
   โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 330.3/330.3 kB 14.1 MB/s eta 0:00:00
Using cached packaging-23.2-py3-none-any.whl (53 kB)
Using cached PyYAML-6.0.1-cp312-cp312-macosx_10_9_x86_64.whl (178 kB)
Downloading regex-2023.12.25-cp312-cp312-macosx_10_9_x86_64.whl (298 kB)
   โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 298.1/298.1 kB 10.2 MB/s eta 0:00:00
Downloading tokenizers-0.15.0-cp312-cp312-macosx_10_7_x86_64.whl (2.6 MB)
   โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 2.6/2.6 MB 14.0 MB/s eta 0:00:00
Downloading tqdm-4.66.1-py3-none-any.whl (78 kB)
   โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 78.3/78.3 kB 4.5 MB/s eta 0:00:00
Downloading typing_extensions-4.9.0-py3-none-any.whl (32 kB)
Using cached filelock-3.13.1-py3-none-any.whl (11 kB)
Downloading importlib_metadata-7.0.1-py3-none-any.whl (23 kB)
Downloading requests-2.31.0-py3-none-any.whl (62 kB)
   โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 62.6/62.6 kB 6.0 MB/s eta 0:00:00
Downloading termcolor-2.4.0-py3-none-any.whl (7.7 kB)
Downloading certifi-2023.11.17-py3-none-any.whl (162 kB)
   โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 162.5/162.5 kB 10.1 MB/s eta 0:00:00
Downloading charset_normalizer-3.3.2-cp312-cp312-macosx_10_9_x86_64.whl (122 kB)
   โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 122.2/122.2 kB 6.7 MB/s eta 0:00:00
Downloading fsspec-2023.12.2-py3-none-any.whl (168 kB)
   โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 169.0/169.0 kB 10.7 MB/s eta 0:00:00
Downloading idna-3.6-py3-none-any.whl (61 kB)
   โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 61.6/61.6 kB 4.4 MB/s eta 0:00:00
Downloading urllib3-2.1.0-py3-none-any.whl (104 kB)
   โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 104.6/104.6 kB 7.5 MB/s eta 0:00:00
Downloading zipp-3.17.0-py3-none-any.whl (7.4 kB)
Building wheels for collected packages: draw2img, fire
  Building wheel for draw2img (pyproject.toml) ... done
  Created wheel for draw2img: filename=draw2img-0.0.1-py3-none-any.whl size=117981 sha256=fdcf88364bba8fd2d83d3f5f43cca7625b16d600315ec7027dabe29e96749490
  Stored in directory: /private/var/folders/dp/h28mjqfd1yq_28qc0gj_vzkw0000gn/T/pip-ephem-wheel-cache-o6rxzl9n/wheels/ce/fa/38/1e08167766c8d23dcd6bb6208239182274ac130325228dda21
  Building wheel for fire (pyproject.toml) ... done
  Created wheel for fire: filename=fire-0.5.0-py2.py3-none-any.whl size=116934 sha256=43204a5a94ada3c63b82b60c1fff7773eac2d56164de19663b74b992421edcfa
  Stored in directory: /Users/tim_vergenz/Library/Caches/pip/wheels/ef/b7/5a/429bf9270449b3fbca3c36b235c97f5ad1585f95cd8d9bb1ab
Successfully built draw2img fire
Installing collected packages: zipp, websockets, urllib3, typing-extensions, tqdm, termcolor, six, safetensors, regex, pyyaml, pillow, packaging, numpy, idna, fsspec, filelock, charset-normalizer, certifi, annotated-types, accelerate, requests, pydantic-core, importlib-metadata, fire, pydantic, huggingface-hub, tokenizers, diffusers, transformers, draw2img
Successfully installed accelerate-0.0.1 annotated-types-0.6.0 certifi-2023.11.17 charset-normalizer-3.3.2 diffusers-0.25.0 draw2img-0.0.1 filelock-3.13.1 fire-0.5.0 fsspec-2023.12.2 huggingface-hub-0.20.2 idna-3.6 importlib-metadata-7.0.1 numpy-1.26.3 packaging-23.2 pillow-10.2.0 pydantic-2.5.3 pydantic-core-2.14.6 pyyaml-6.0.1 regex-2023.12.25 requests-2.31.0 safetensors-0.4.1 six-1.16.0 termcolor-2.4.0 tokenizers-0.15.0 tqdm-4.66.1 transformers-4.36.2 typing-extensions-4.9.0 urllib3-2.1.0 websockets-12.0 zipp-3.17.0

[notice] A new release of pip is available: 23.3.1 -> 23.3.2
[notice] To update, run: pip install --upgrade pip

Draw2Img on โคด main (4df6dad) is ๐Ÿ“ฆ v0.0.1 via ๐Ÿ v3.12.0 (.venv) on โ˜๏ธ   took 26s
14:35:51 $ python draw2img/main.py
Traceback (most recent call last):
  File "/Users/tim_vergenz/code/Draw2Img/draw2img/main.py", line 11, in <module>
    from draw2img.server import server
  File "/Users/tim_vergenz/code/Draw2Img/.venv/lib/python3.12/site-packages/draw2img/__init__.py", line 1, in <module>
    from .main import main
  File "/Users/tim_vergenz/code/Draw2Img/.venv/lib/python3.12/site-packages/draw2img/main.py", line 11, in <module>
    from draw2img.server import server
  File "/Users/tim_vergenz/code/Draw2Img/.venv/lib/python3.12/site-packages/draw2img/server/__init__.py", line 1, in <module>
    from .main import server
  File "/Users/tim_vergenz/code/Draw2Img/.venv/lib/python3.12/site-packages/draw2img/server/main.py", line 9, in <module>
    import torch
ModuleNotFoundError: No module named 'torch'

Error Response

Getting the following when running the localserver.

Error response
Error code: 404

Message: File not found.

Error code explanation: HTTPStatus.NOT_FOUND - Nothing matches the given URI.

The interface started but the model draws once in a strange way, then refuses to draw

127.0.0.1 - - [09/Apr/2024 10:45:18] "GET / HTTP/1.1" 304 -
127.0.0.1 - - [09/Apr/2024 10:45:19] code 404, message File not found
127.0.0.1 - - [09/Apr/2024 10:45:19] "GET /site.webmanifest HTTP/1.1" 404 -
Exception in thread Thread-8 (inference_loop):
Traceback (most recent call last):
File "C:\Python\lib\threading.py", line 1016, in _bootstrap_inner
self.run()
File "C:\Python\lib\threading.py", line 953, in run
self._target(*self._args, **self._kwargs)
File "C:\Python\lib\site-packages\draw2img\server\main.py", line 86, in inference_loop
params = Params.model_validate(obj)
AttributeError: type object 'Params' has no attribute 'model_validate'

1
2024-04-09T07_49_22 171Z_output
2

ModuleNotFoundError: No module named 'websockets.sync'

The websockets module is already installed. The error appears to be due to the fact that the synchronous version of websockets is being used while the code is trying to import the websockets.sync module.

Traceback (most recent call last):
File "D:\AI\Draw2Img\Draw2Img-main\draw2img\main.py", line 11, in
from draw2img.server import server
File "C:\Python\lib\site-packages\draw2img_init_.py", line 1, in
from .main import main
File "C:\Python\lib\site-packages\draw2img\main.py", line 11, in
from draw2img.server import server
File "C:\Python\lib\site-packages\draw2img\server_init_.py", line 1, in
from .main import server
File "C:\Python\lib\site-packages\draw2img\server\main.py", line 13, in
from websockets.sync.server import WebSocketServer, serve
ModuleNotFoundError: No module named 'websockets.sync'

error: subprocess-exited-with-error

enviroment win10 x64 python-3.12.1-amd64.exe

after pip install . all ok but at the end of progression show error such as follows:

Preparing metadata (pyproject.toml): started
Preparing metadata (pyproject.toml): finished with status 'error'
error: subprocess-exited-with-error

Preparing metadata (pyproject.toml) did not run successfully.
exit code: 1

[6 lines of output]

Cargo, the Rust package manager, is not installed or is not on PATH.
This package requires Rust and Cargo to compile extensions. Install it through
the system's package manager or via https://rustup.rs/

Checking for Rust toolchain....
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

Encountered error while generating package metadata.

See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

[notice] A new release of pip is available: 23.2.1 -> 23.3.2
[notice] To update, run: python.exe -m pip install --upgrade pip


then go on next step the console show :
$ python draw2img/main.py
Traceback (most recent call last):
File "C:\Users\yangyanghub\Desktop\draw2\Draw2Img\draw2img\main.py", line 9, in
import fire
ModuleNotFoundError: No module named 'fire'

i can`t do it

pip : The term 'pip' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that
the path is correct and try again.
At line:1 char:1

  • pip install .
  •   + CategoryInfo          : ObjectNotFound: (pip:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException
    

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.