artdwn/stable-diffusion-backup
Stable Diffusion web UI A browser interface based on Gradio library for Stable Diffusion. Features Detailed feature showcase with images: Original txt2img and img2img modes One click install and run script (but you still must install python and git) Outpainting Inpainting Color Sketch Prompt Matrix Stable Diffusion Upscale Attention, specify parts of text that the model should pay more attention to a man in a ((tuxedo)) - will pay more attention to tuxedo a man… See the full description on the dataset page: https://huggingface.co/datasets/artdwn/stable-diffusion-backup.
11.1k
1(function() {2 const GRADIO_MIN_WIDTH = 320;3 const GRID_TEMPLATE_COLUMNS = '1fr 16px 1fr';4 const PAD = 16;5 const DEBOUNCE_TIME = 100;6 7 const R = {8 tracking: false,9 parent: null,10 parentWidth: null,11 leftCol: null,12 leftColStartWidth: null,13 screenX: null,14 };15 16 let resizeTimer;17 let parents = [];18 19 function setLeftColGridTemplate(el, width) {20 el.style.gridTemplateColumns = `${width}px 16px 1fr`;21 }22 23 function displayResizeHandle(parent) {24 if (window.innerWidth < GRADIO_MIN_WIDTH * 2 + PAD * 4) {25 parent.style.display = 'flex';26 if (R.handle != null) {27 R.handle.style.opacity = '0';28 }29 return false;30 } else {31 parent.style.display = 'grid';32 if (R.handle != null) {33 R.handle.style.opacity = '100';34 }35 return true;36 }37 }38 39 function afterResize(parent) {40 if (displayResizeHandle(parent) && parent.style.gridTemplateColumns != GRID_TEMPLATE_COLUMNS) {41 const oldParentWidth = R.parentWidth;42 const newParentWidth = parent.offsetWidth;43 const widthL = parseInt(parent.style.gridTemplateColumns.split(' ')[0]);44 45 const ratio = newParentWidth / oldParentWidth;46 47 const newWidthL = Math.max(Math.floor(ratio * widthL), GRADIO_MIN_WIDTH);48 setLeftColGridTemplate(parent, newWidthL);49 50 R.parentWidth = newParentWidth;51 }52 }53 54 function setup(parent) {55 const leftCol = parent.firstElementChild;56 const rightCol = parent.lastElementChild;57 58 parents.push(parent);59 60 parent.style.display = 'grid';61 parent.style.gap = '0';62 parent.style.gridTemplateColumns = GRID_TEMPLATE_COLUMNS;63 64 const resizeHandle = document.createElement('div');65 resizeHandle.classList.add('resize-handle');66 parent.insertBefore(resizeHandle, rightCol);67 68 resizeHandle.addEventListener('mousedown', (evt) => {69 if (evt.button !== 0) return;70 71 evt.preventDefault();72 evt.stopPropagation();73 74 document.body.classList.add('resizing');75 76 R.tracking = true;77 R.parent = parent;78 R.parentWidth = parent.offsetWidth;79 R.handle = resizeHandle;80 R.leftCol = leftCol;81 R.leftColStartWidth = leftCol.offsetWidth;82 R.screenX = evt.screenX;83 });84 85 resizeHandle.addEventListener('dblclick', (evt) => {86 evt.preventDefault();87 evt.stopPropagation();88 89 parent.style.gridTemplateColumns = GRID_TEMPLATE_COLUMNS;90 });91 92 afterResize(parent);93 }94 95 window.addEventListener('mousemove', (evt) => {96 if (evt.button !== 0) return;97 98 if (R.tracking) {99 evt.preventDefault();100 evt.stopPropagation();101 102 const delta = R.screenX - evt.screenX;103 const leftColWidth = Math.max(Math.min(R.leftColStartWidth - delta, R.parent.offsetWidth - GRADIO_MIN_WIDTH - PAD), GRADIO_MIN_WIDTH);104 setLeftColGridTemplate(R.parent, leftColWidth);105 }106 });107 108 window.addEventListener('mouseup', (evt) => {109 if (evt.button !== 0) return;110 111 if (R.tracking) {112 evt.preventDefault();113 evt.stopPropagation();114 115 R.tracking = false;116 117 document.body.classList.remove('resizing');118 }119 });120 121 122 window.addEventListener('resize', () => {123 clearTimeout(resizeTimer);124 125 resizeTimer = setTimeout(function() {126 for (const parent of parents) {127 afterResize(parent);128 }129 }, DEBOUNCE_TIME);130 });131 132 setupResizeHandle = setup;133})();134 135onUiLoaded(function() {136 for (var elem of gradioApp().querySelectorAll('.resize-handle-row')) {137 if (!elem.querySelector('.resize-handle')) {138 setupResizeHandle(elem);139 }140 }141});142 