Skip to content

Commit

Permalink
New Keyboard Shortcuts, include yarn.lock, prep for ONNX frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
Stax124 committed May 19, 2023
1 parent f044140 commit 9739dca
Show file tree
Hide file tree
Showing 38 changed files with 4,234 additions and 251 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ docs/.vitepress/dist
/engine
/static/output
/outputs
/frontend/yarn.lock
/testing
/typings
external
Expand Down
18 changes: 17 additions & 1 deletion core/config/config.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import logging
import multiprocessing
from dataclasses import Field, dataclass, field, fields
from typing import Dict, List, Literal, Union
from typing import Dict, List, Literal, Optional, Union

import torch
from dataclasses_json import CatchAll, DataClassJsonMixin, Undefined, dataclass_json
Expand All @@ -10,6 +10,14 @@
logger = logging.getLogger(__name__)


@dataclass
class QuantDict:
vae_decoder: Optional[bool] = None
vae_encoder: Optional[bool] = None
unet: Optional[bool] = None
text_encoder: Optional[bool] = None


@dataclass
class Txt2ImgConfig:
"Configuration for the text to image pipeline"
Expand Down Expand Up @@ -181,6 +189,13 @@ class AITemplateConfig:
num_threads: int = field(default=min(multiprocessing.cpu_count() - 1, 8))


@dataclass
class ONNXConfig:
"Configuration for ONNX acceleration"

quant_dict: QuantDict = field(default_factory=QuantDict)


@dataclass
class BotConfig:
"Configuration for the bot"
Expand Down Expand Up @@ -233,6 +248,7 @@ class Configuration(DataClassJsonMixin):
api: APIConfig = field(default_factory=APIConfig)
interrogator: InterrogatorConfig = field(default_factory=InterrogatorConfig)
aitemplate: AITemplateConfig = field(default_factory=AITemplateConfig)
onnx: ONNXConfig = field(default_factory=ONNXConfig)
bot: BotConfig = field(default_factory=BotConfig)
frontend: FrontendConfig = field(default_factory=FrontendConfig)
extra: CatchAll = field(default_factory=dict)
Expand Down
1 change: 0 additions & 1 deletion frontend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ node_modules
dist-ssr
coverage
*.local
yarn.lock

/cypress/videos/
/cypress/screenshots/
Expand Down
2 changes: 1 addition & 1 deletion frontend/dist/assets/AboutView.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { _ as _export_sfc, o as openBlock, e as createElementBlock, l as createBaseVNode } from "./index.js";
import { _ as _export_sfc, o as openBlock, e as createElementBlock, m as createBaseVNode } from "./index.js";
const _sfc_main = {};
const _hoisted_1 = { class: "about" };
const _hoisted_2 = /* @__PURE__ */ createBaseVNode("h1", null, "This is an about page", -1);
Expand Down
304 changes: 280 additions & 24 deletions frontend/dist/assets/AccelerateView.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion frontend/dist/assets/CloudUpload.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { d as defineComponent, o as openBlock, e as createElementBlock, l as createBaseVNode } from "./index.js";
import { d as defineComponent, o as openBlock, e as createElementBlock, m as createBaseVNode } from "./index.js";
const _hoisted_1 = {
xmlns: "http://www.w3.org/2000/svg",
"xmlns:xlink": "http://www.w3.org/1999/xlink",
Expand Down
2 changes: 1 addition & 1 deletion frontend/dist/assets/ExtraView.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { _ as _sfc_main$2 } from "./GenerateSection.vue_vue_type_script_setup_true_lang.js";
import { _ as _sfc_main$3 } from "./ImageOutput.vue_vue_type_script_setup_true_lang.js";
import { I as ImageUpload } from "./ImageUpload.js";
import { d as defineComponent, u as useState, a as useSettings, b as useMessage, o as openBlock, e as createElementBlock, f as createVNode, w as withCtx, g as unref, N as NGi, h as NCard, i as NSpace, l as createBaseVNode, n as NSelect, G as upscalerOptions, m as NTooltip, k as createTextVNode, p as NSlider, s as NGrid, x as serverUrl, y as pushScopeId, z as popScopeId, _ as _export_sfc, q as createBlock, E as NTabPane, F as NTabs } from "./index.js";
import { d as defineComponent, u as useState, a as useSettings, b as useMessage, o as openBlock, e as createElementBlock, f as createVNode, w as withCtx, g as unref, N as NGi, h as NCard, i as NSpace, m as createBaseVNode, q as NSelect, I as upscalerOptions, n as NTooltip, l as createTextVNode, r as NSlider, x as NGrid, z as serverUrl, A as pushScopeId, B as popScopeId, _ as _export_sfc, s as createBlock, G as NTabPane, H as NTabs } from "./index.js";
import { N as NInputNumber } from "./InputNumber.js";
import "./Image.js";
import "./CloudUpload.js";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { d as defineComponent, o as openBlock, e as createElementBlock, l as createBaseVNode, u as useState, a as useSettings, q as createBlock, w as withCtx, f as createVNode, g as unref, N as NGi, C as NButton, D as NIcon, k as createTextVNode, s as NGrid, bw as NAlert, r as createCommentVNode, h as NCard, x as serverUrl } from "./index.js";
import { d as defineComponent, o as openBlock, e as createElementBlock, m as createBaseVNode, u as useState, a as useSettings, D as ref, bi as onMounted, aO as onUnmounted, z as serverUrl, s as createBlock, w as withCtx, f as createVNode, g as unref, N as NGi, E as NButton, F as NIcon, l as createTextVNode, x as NGrid, by as NAlert, v as createCommentVNode, h as NCard } from "./index.js";
const _hoisted_1$1 = {
xmlns: "http://www.w3.org/2000/svg",
"xmlns:xlink": "http://www.w3.org/1999/xlink",
Expand Down Expand Up @@ -56,6 +56,27 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
const props = __props;
const global = useState();
const conf = useSettings();
const generateButton = ref(null);
onMounted(() => {
window.addEventListener("keydown", handleKeyDown);
});
onUnmounted(() => {
window.removeEventListener("keydown", handleKeyDown);
});
function handleKeyDown(e) {
if (e.key === "Enter" && e.ctrlKey) {
e.preventDefault();
if (global.state.generating) {
return;
}
const fn = props.generate;
fn(e);
}
if (e.key === "Escape") {
e.preventDefault();
interrupt();
}
}
function interrupt() {
fetch(`${serverUrl}/api/general/interrupt`, {
method: "POST"
Expand All @@ -81,6 +102,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
return [
createVNode(unref(NButton), {
type: "success",
ref_key: "generateButton",
ref: generateButton,
onClick: props.generate,
disabled: unref(global).state.generating || ((_a2 = unref(conf).data.settings.model) == null ? void 0 : _a2.name) === "" || ((_b2 = unref(conf).data.settings.model) == null ? void 0 : _b2.name) === void 0,
loading: unref(global).state.generating,
Expand Down
2 changes: 1 addition & 1 deletion frontend/dist/assets/Image.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { bl as toString, K as replaceable, A as h, d as defineComponent, aY as isBrowser, a1 as useTheme, R as createInjectionKey, T as c, U as cB, bm as fadeInTransition, aU as fadeInScaleUpTransition, an as cNotM, Q as toRef, bn as imageLight, B as ref, ao as useLocale, aa as watch, aE as onBeforeUnmount, aF as off, c as computed, L as useConfig, a5 as useThemeClass, bo as isMounted, bp as LazyTeleport, bq as withDirectives, br as zindexable, aV as Transition, H as Fragment, ar as NBaseIcon, bs as vShow, $ as inject, a8 as on, bt as normalizeStyle, m as NTooltip, aT as beforeNextFrameOnce, a6 as createId, P as provide, bc as getCurrentInstance, bg as onMounted, ap as watchEffect } from "./index.js";
import { bn as toString, M as replaceable, C as h, d as defineComponent, a_ as isBrowser, a3 as useTheme, T as createInjectionKey, V as c, W as cB, bo as fadeInTransition, aW as fadeInScaleUpTransition, ap as cNotM, S as toRef, bp as imageLight, D as ref, aq as useLocale, ac as watch, aG as onBeforeUnmount, aH as off, c as computed, O as useConfig, a7 as useThemeClass, bq as isMounted, br as LazyTeleport, bs as withDirectives, bt as zindexable, aX as Transition, J as Fragment, at as NBaseIcon, bu as vShow, a1 as inject, aa as on, bv as normalizeStyle, n as NTooltip, aV as beforeNextFrameOnce, a8 as createId, R as provide, be as getCurrentInstance, bi as onMounted, ar as watchEffect } from "./index.js";
function arrayReduce(array, iteratee, accumulator, initAccum) {
var index = -1, length = array == null ? 0 : array.length;
if (initAccum && length) {
Expand Down
26 changes: 13 additions & 13 deletions frontend/dist/assets/Image2ImageView.css
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@

.image-container img[data-v-00b57bb7] {
.image-container img[data-v-60d25d91] {
width: 100%;
height: 100%;
object-fit: contain;
overflow: hidden;
}
.image-container[data-v-00b57bb7] {
.image-container[data-v-60d25d91] {
height: 70vh;
width: 100%;
display: flex;
justify-content: center;
}

.image-container img[data-v-a0cf6b8e] {
.image-container img[data-v-c35cb41b] {
width: 100%;
height: 100%;
object-fit: contain;
overflow: hidden;
}
.image-container[data-v-a0cf6b8e] {
.image-container[data-v-c35cb41b] {
height: 70vh;
width: 100%;
display: flex;
justify-content: center;
}

.hidden-input[data-v-70e07d04] {
.hidden-input[data-v-019cbc5d] {
display: none;
}
.utility-button[data-v-70e07d04] {
.utility-button[data-v-019cbc5d] {
margin-right: 8px;
}
.file-upload[data-v-70e07d04] {
.file-upload[data-v-019cbc5d] {
appearance: none;
background-color: transparent;
border: 1px solid #63e2b7;
Expand All @@ -51,33 +51,33 @@
vertical-align: middle;
white-space: nowrap;
}
.file-upload[data-v-70e07d04]:focus:not(:focus-visible):not(.focus-visible) {
.file-upload[data-v-019cbc5d]:focus:not(:focus-visible):not(.focus-visible) {
box-shadow: none;
outline: none;
}
.file-upload[data-v-70e07d04]:focus {
.file-upload[data-v-019cbc5d]:focus {
box-shadow: rgba(46, 164, 79, 0.4) 0 0 0 3px;
outline: none;
}
.file-upload[data-v-70e07d04]:disabled {
.file-upload[data-v-019cbc5d]:disabled {
background-color: #94d3a2;
border-color: rgba(27, 31, 35, 0.1);
color: rgba(255, 255, 255, 0.8);
cursor: default;
}
.image-container[data-v-70e07d04] {
.image-container[data-v-019cbc5d] {
width: 100%;
display: flex;
justify-content: center;
}

.image-container img[data-v-dfbee01e] {
.image-container img[data-v-e7e3c87a] {
width: 100%;
height: 100%;
object-fit: contain;
overflow: hidden;
}
.image-container[data-v-dfbee01e] {
.image-container[data-v-e7e3c87a] {
height: 70vh;
width: 100%;
display: flex;
Expand Down

0 comments on commit 9739dca

Please sign in to comment.