mirror of
https://github.com/easydiffusion/easydiffusion.git
synced 2025-06-20 18:08:00 +02:00
Added cross page use these settings
This commit is contained in:
parent
4faa334bf6
commit
2079283713
@ -116,7 +116,7 @@ def init():
|
||||
try:
|
||||
image: GalleryImage = db.query(GalleryImage).filter(GalleryImage.path == image_path).first()
|
||||
head = "<head><link rel='stylesheet' href='/media/css/single-gallery.css'></head>"
|
||||
body = "<body><div><button id='use_these_settings' class='primaryButton'>Use these settings</button><button id='use_as_input' class='primaryButton'>Use as Input</button></div><img src='/image/" + image.path + "'>" + image.htmlForm() + "</body>"
|
||||
body = f"<body><div><button id='use_these_settings' class='primaryButton' json='{image.settingsJSON()}'>Use these settings</button><button id='use_as_input' class='primaryButton'>Use as Input</button></div><img src='/image/" + image.path + "'>" + image.htmlForm() + "</body>"
|
||||
return Response(content="<html>" + head + body + "</head>", media_type="text/html")
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
@ -50,6 +50,31 @@ class GalleryImage(Base):
|
||||
"<p>Upscale: " + str(self.use_upscale) + "</p>" + \
|
||||
"<p>Time Created: " + str(self.time_created) + "</p>" + \
|
||||
"<p>NSFW: " + str(self.nsfw) + "</p></div>"
|
||||
|
||||
def settingsJSON(self) -> str:
|
||||
# some are still missing: prompt strength, lora
|
||||
json = {
|
||||
"numOutputsTotal": 1,
|
||||
"seed": self.seed,
|
||||
"reqBody": {
|
||||
"prompt": self.prompt,
|
||||
"negative_prompt": self.negative_prompt,
|
||||
"width": self.width,
|
||||
"height": self.height,
|
||||
"seed": self.seed,
|
||||
"num_inference_steps": self.num_inference_steps,
|
||||
"guidance_scale": self.guidance_scale,
|
||||
"use_face_correction": self.use_face_correction,
|
||||
"use_upscale": self.use_upscale,
|
||||
"sampler_name": self.sampler_name,
|
||||
"use_stable_diffusion_model": self.use_stable_diffusion_model,
|
||||
"clip_skip": self.clip_skip,
|
||||
"tiling": self.tiling,
|
||||
"use_vae_model": self.use_vae_model,
|
||||
"use_hypernetwork_model": self.use_hypernetwork_model
|
||||
}}
|
||||
from json import dumps
|
||||
return dumps(json)
|
||||
|
||||
|
||||
from easydiffusion.easydb.database import engine
|
||||
|
@ -3094,7 +3094,7 @@ function galleryImage(item) {
|
||||
w.addEventListener("DOMContentLoaded", () => {
|
||||
w.document.getElementsByTagName("body")[0].classList.add(themeField.value)
|
||||
w.document.getElementById("use_these_settings").addEventListener("click", () => {
|
||||
alert("use these settings")
|
||||
restoreTaskToUI(JSON.parse(w.document.getElementById("use_these_settings").getAttribute("json")))
|
||||
})
|
||||
w.document.getElementById("use_as_input").addEventListener("click", () => {
|
||||
alert("use as input")
|
||||
|
Loading…
x
Reference in New Issue
Block a user