Skip to content

Commit

Permalink
canvas resizer
Browse files Browse the repository at this point in the history
  • Loading branch information
Pythongor committed Jul 13, 2023
1 parent 36e9226 commit 9528697
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 12 deletions.
4 changes: 4 additions & 0 deletions README_Web.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,17 @@ This is main control panel of this app. Here are:
- `Clear` button. Resets `painting canvas`
- `Instant mode` button. Switches instant mode (requests image redraw just when you stroke)
- `Zen mode` button. Enters simplified interface mode
- `Audio signal` customizer. Toggles audio signal and customizes the theme
- `Generate` button. Triggers ControlNet API image generation.

### `Painting canvas`

![image](images/web_canvas.png)

This is area for drawing. If instant mode enabled, after each stroke image will be requested.
Size of canvas (and result image) can be customized:

![image](images/web_resizer.png)

### `Result area`

Expand Down
Binary file added images/web_resizer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/web_tools.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 12 additions & 8 deletions scripts/views/WebView/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,6 @@ async def root():
return json.load(f)


@app.post('/skip')
async def root():
response = api.skip_rendering()
if response.ok:
state.server["busy"] = False
return response.json()


@app.post('/config')
async def root(data: Request):
data = await data.json()
Expand All @@ -70,12 +62,22 @@ async def root(data: Request):
json_data["steps"] = data["steps"]
json_data["cfg_scale"] = data["cfg_scale"]
json_data["batch_size"] = data["batch_size"]
json_data["width"] = data["width"]
json_data["height"] = data["height"]
json_data["controlnet_units"][0]["module"] = data["module"]
json_data["controlnet_units"][0]["model"] = data["model"]
with open('./controlnet.json', 'w') as f:
f.write(json.dumps(json_data, indent=4))


@app.post('/skip')
async def root():
response = api.skip_rendering()
if response.ok:
state.server["busy"] = False
return response.json()


@app.get('/models')
async def root():
return state.control_net["controlnet_models"]
Expand All @@ -98,6 +100,8 @@ async def root(data: Request):
state["main_json_data"]["prompt"] = data["config"]["prompt"]
state["main_json_data"]["negative_prompt"] = data["config"]["negative_prompt"]
state["main_json_data"]["seed"] = data["config"]["seed"]
state["main_json_data"]["width"] = data["config"]["width"]
state["main_json_data"]["height"] = data["config"]["height"]
t = threading.Thread(target=send_request)
t.start()

Expand Down
2 changes: 1 addition & 1 deletion scripts/views/WebView/build/static/css/main.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion scripts/views/WebView/build/static/css/main.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion scripts/views/WebView/build/static/js/main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion scripts/views/WebView/build/static/js/main.js.map

Large diffs are not rendered by default.

0 comments on commit 9528697

Please sign in to comment.