Styled up the opened tab

This commit is contained in:
ManInDark 2023-08-10 23:27:35 +02:00
parent 39459f14c5
commit 4faa334bf6
No known key found for this signature in database
GPG Key ID: 72EC12A5B2D62779
4 changed files with 57 additions and 24 deletions

View File

@ -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='button'></button></div><img src='/image/" + image.path + "'>" + image.htmlForm() + "</body>"
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>"
return Response(content="<html>" + head + body + "</head>", media_type="text/html")
except Exception as e:
print(e)

View File

@ -25,31 +25,31 @@ class GalleryImage(Base):
prompt = Column(String)
negative_prompt = Column(String)
time_created = Column(DateTime(timezone=True), server_default=func.now())
nsfw = Column(String, server_default='unknown')
nsfw = Column(Boolean, server_default=None)
def __repr__(self):
return "<GalleryImage(path='%s', seed='%s', use_stable_diffusion_model='%s', clip_skip='%s', use_vae_model='%s', sampler_name='%s', width='%s', height='%s', num_inference_steps='%s', guidance_scale='%s', lora='%s', use_hypernetwork_model='%s', tiling='%s', use_face_correction='%s', use_upscale='%s', prompt='%s', negative_prompt='%s')>" % (
self.path, self.seed, self.use_stable_diffusion_model, self.clip_skip, self.use_vae_model, self.sampler_name, self.width, self.height, self.num_inference_steps, self.guidance_scale, self.lora, self.use_hypernetwork_model, self.tiling, self.use_face_correction, self.use_upscale, self.prompt, self.negative_prompt)
def htmlForm(self) -> str:
return "<div><p>Path: " + str(self.path) + "</p>" + \
"Seed: " + str(self.seed) + "</p>" + \
"Stable Diffusion Model: " + str(self.use_stable_diffusion_model) + "</p>" + \
"Prompt: " + str(self.prompt) + "</p>" + \
"Negative Prompt: " + str(self.negative_prompt) + "</p>" + \
"Clip Skip: " + str(self.clip_skip) + "</p>" + \
"VAE Model: " + str(self.use_vae_model) + "</p>" + \
"Sampler: " + str(self.sampler_name) + "</p>" + \
"Size: " + str(self.height) + "x" + str(self.width) + "</p>" + \
"Inference Steps: " + str(self.num_inference_steps) + "</p>" + \
"Guidance Scale: " + str(self.guidance_scale) + "</p>" + \
"LoRA: " + str(self.lora) + "</p>" + \
"Hypernetwork: " + str(self.use_hypernetwork_model) + "</p>" + \
"Tiling: " + str(self.tiling) + "</p>" + \
"Face Correction: " + str(self.use_face_correction) + "</p>" + \
"Upscale: " + str(self.use_upscale) + "</p>" + \
"Time Created: " + str(self.time_created) + "</p>" + \
"NSFW: " + str(self.nsfw) + "</p></div>"
return "<div class='panel-box'><p>Path: " + str(self.path) + "</p>" + \
"<p>Seed: " + str(self.seed) + "</p>" + \
"<p>Stable Diffusion Model: " + str(self.use_stable_diffusion_model) + "</p>" + \
"<p>Prompt: " + str(self.prompt) + "</p>" + \
"<p>Negative Prompt: " + str(self.negative_prompt) + "</p>" + \
"<p>Clip Skip: " + str(self.clip_skip) + "</p>" + \
"<p>VAE Model: " + str(self.use_vae_model) + "</p>" + \
"<p>Sampler: " + str(self.sampler_name) + "</p>" + \
"<p>Size: " + str(self.height) + "x" + str(self.width) + "</p>" + \
"<p>Inference Steps: " + str(self.num_inference_steps) + "</p>" + \
"<p>Guidance Scale: " + str(self.guidance_scale) + "</p>" + \
"<p>LoRA: " + str(self.lora) + "</p>" + \
"<p>Hypernetwork: " + str(self.use_hypernetwork_model) + "</p>" + \
"<p>Tiling: " + str(self.tiling) + "</p>" + \
"<p>Face Correction: " + str(self.use_face_correction) + "</p>" + \
"<p>Upscale: " + str(self.use_upscale) + "</p>" + \
"<p>Time Created: " + str(self.time_created) + "</p>" + \
"<p>NSFW: " + str(self.nsfw) + "</p></div>"
from easydiffusion.easydb.database import engine

View File

@ -1,9 +1,38 @@
@import url("/media/css/themes.css");
@import url("/media/css/main.css");
body {
display: flex;
flex-direction: column;
align-items: center;
background-color: var(--background-color1);
}
p {
margin: 0px;
img {
border-radius: 5px;
}
p, h1, h2, h3, h4, h5, h6 {
color: var(--text-color);
cursor: default;
margin: 6px;
}
::-moz-selection {
/* Code for Firefox */
color: none;
background: none;
}
::selection {
color: none;
background: none;
}
button {
margin: 8px;
}
div {
margin: 16px;
}

View File

@ -3092,8 +3092,12 @@ function galleryImage(item) {
let w;
w = window.open("/single_image?image_path=" + item.path, "_blank")
w.addEventListener("DOMContentLoaded", () => {
w.document.getElementById("button").addEventListener("click", () => {
document.title = "hi"
w.document.getElementsByTagName("body")[0].classList.add(themeField.value)
w.document.getElementById("use_these_settings").addEventListener("click", () => {
alert("use these settings")
})
w.document.getElementById("use_as_input").addEventListener("click", () => {
alert("use as input")
})
})
})