Update app.py
Browse files
app.py
CHANGED
|
@@ -93,9 +93,6 @@ async def infer(model_str, prompt, nprompt="", height=0, width=0, steps=0, cfg=0
|
|
| 93 |
raise Exception() from e
|
| 94 |
if task.done() and result is not None and not isinstance(result, tuple):
|
| 95 |
with lock:
|
| 96 |
-
# png_path = "img.png"
|
| 97 |
-
# png_path = get_current_time() + "_" + model_str.replace("/", "_") + ".png"
|
| 98 |
-
# png_path = model_str.replace("/", "_") + " - " + prompt + " - " + get_current_time() + ".png"
|
| 99 |
png_path = model_str.replace("/", "_") + " - " + get_current_time() + "_" + str(theSeed) + ".png"
|
| 100 |
image = save_image(result, png_path, model_str, prompt, nprompt, height, width, steps, cfg, seed)
|
| 101 |
return image
|
|
@@ -131,33 +128,7 @@ CSS="""
|
|
| 131 |
.guide { text-align: center; !important; }
|
| 132 |
"""
|
| 133 |
|
| 134 |
-
|
| 135 |
-
function refresh() {
|
| 136 |
-
const url = new URL(window.location);
|
| 137 |
-
if (url.searchParams.get('__theme') !== 'dark') {
|
| 138 |
-
url.searchParams.set('__theme', 'dark');
|
| 139 |
-
window.location.href = url.href;
|
| 140 |
-
}
|
| 141 |
-
}
|
| 142 |
-
"""
|
| 143 |
-
|
| 144 |
-
js_AutoSave="""
|
| 145 |
-
console.log("Yo");
|
| 146 |
-
|
| 147 |
-
var img1 = document.querySelector("div#component-355 .svelte-1kpcxni button.svelte-1kpcxni .svelte-1kpcxni img"),
|
| 148 |
-
observer = new MutationObserver((changes) => {
|
| 149 |
-
changes.forEach(change => {
|
| 150 |
-
if(change.attributeName.includes('src')){
|
| 151 |
-
console.log(img1.src);
|
| 152 |
-
document.querySelector("div#component-355 .svelte-1kpcxni .svelte-sr71km a.svelte-1s8vnbx button").click();
|
| 153 |
-
}
|
| 154 |
-
});
|
| 155 |
-
});
|
| 156 |
-
observer.observe(img1, {attributes : true});
|
| 157 |
-
|
| 158 |
-
"""
|
| 159 |
-
|
| 160 |
-
with gr.Blocks(theme='NoCrypt/miku@>=1.2.2', fill_width=True, css=CSS) as demo:
|
| 161 |
# with gr.Blocks(theme='JohnSmith9982/small_and_pretty', fill_width=True, css=CSS, js=js_func) as demo:
|
| 162 |
gr.HTML("")
|
| 163 |
with gr.Tab('6 Models'):
|
|
|
|
| 93 |
raise Exception() from e
|
| 94 |
if task.done() and result is not None and not isinstance(result, tuple):
|
| 95 |
with lock:
|
|
|
|
|
|
|
|
|
|
| 96 |
png_path = model_str.replace("/", "_") + " - " + get_current_time() + "_" + str(theSeed) + ".png"
|
| 97 |
image = save_image(result, png_path, model_str, prompt, nprompt, height, width, steps, cfg, seed)
|
| 98 |
return image
|
|
|
|
| 128 |
.guide { text-align: center; !important; }
|
| 129 |
"""
|
| 130 |
|
| 131 |
+
with gr.Blocks(fill_width=True, css=CSS) as demo:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 132 |
# with gr.Blocks(theme='JohnSmith9982/small_and_pretty', fill_width=True, css=CSS, js=js_func) as demo:
|
| 133 |
gr.HTML("")
|
| 134 |
with gr.Tab('6 Models'):
|