mirror of
https://github.com/easydiffusion/easydiffusion.git
synced 2025-06-20 18:08:00 +02:00
Switch to disable gallery
This commit is contained in:
parent
bd980c0b5e
commit
4dc93186da
@ -100,9 +100,9 @@ def init():
|
||||
raise HTTPException(status_code=404, detail="Image not found")
|
||||
|
||||
@server_api.get("/all_images")
|
||||
def get_all_images(prompt: str = "", model: str = "", page: int = 0, images_per_page: int = 50, db: Session = Depends(get_db)):
|
||||
def get_all_images(prompt: str = "", model: str = "", page: int = 0, images_per_page: int = 50, workspace : str = "default", db: Session = Depends(get_db)):
|
||||
from easydiffusion.easydb.mappings import GalleryImage
|
||||
images = db.query(GalleryImage).order_by(GalleryImage.time_created.desc())
|
||||
images = db.query(GalleryImage).filter(GalleryImage.workspace == workspace).order_by(GalleryImage.time_created.desc())
|
||||
if prompt != "":
|
||||
images = images.filter(GalleryImage.prompt.like("%"+prompt+"%"))
|
||||
if model != "":
|
||||
|
@ -85,6 +85,7 @@ class TaskData(BaseModel):
|
||||
clip_skip: bool = False
|
||||
codeformer_upscale_faces: bool = False
|
||||
codeformer_fidelity: float = 0.5
|
||||
use_gallery: str = None
|
||||
|
||||
|
||||
class MergeRequest(BaseModel):
|
||||
|
@ -160,6 +160,7 @@ def save_images_to_disk(
|
||||
from easydiffusion.easydb.mappings import GalleryImage
|
||||
from easydiffusion.easydb.database import SessionLocal
|
||||
|
||||
if task_data.use_gallery != None:
|
||||
session = SessionLocal()
|
||||
session.add(GalleryImage(
|
||||
path = path_i,
|
||||
@ -178,7 +179,8 @@ def save_images_to_disk(
|
||||
use_face_correction = metadata_entries[i]["use_face_correction"],
|
||||
use_upscale = metadata_entries[i]["use_upscale"],
|
||||
prompt = metadata_entries[i]["prompt"],
|
||||
negative_prompt = metadata_entries[i]["negative_prompt"]
|
||||
negative_prompt = metadata_entries[i]["negative_prompt"],
|
||||
workspace = task_data.use_gallery
|
||||
))
|
||||
session.commit()
|
||||
session.close()
|
||||
|
@ -1031,6 +1031,9 @@ input::file-selector-button {
|
||||
.input-toggle > input:checked + label {
|
||||
background: var(--accent-color);
|
||||
}
|
||||
.input-toggle > input:disabled + label {
|
||||
background: var(--background-color1);
|
||||
}
|
||||
.input-toggle > input:checked + label:before {
|
||||
right: calc(var(--input-border-size) + var(--input-switch-padding));
|
||||
opacity: 1;
|
||||
|
@ -14,6 +14,7 @@ const SETTINGS_IDS_LIST = [
|
||||
"num_outputs_parallel",
|
||||
"stable_diffusion_model",
|
||||
"clip_skip",
|
||||
"use_gallery",
|
||||
"vae_model",
|
||||
"hypernetwork_model",
|
||||
"sampler_name",
|
||||
|
@ -199,6 +199,7 @@ let undoButton = document.querySelector("#undo")
|
||||
let undoBuffer = []
|
||||
const UNDO_LIMIT = 20
|
||||
const MAX_IMG_UNDO_ENTRIES = 5
|
||||
var GALLERY_NAME="default"
|
||||
|
||||
let IMAGE_STEP_SIZE = 64
|
||||
|
||||
@ -1542,6 +1543,7 @@ function getCurrentUserRequest() {
|
||||
output_quality: parseInt(outputQualityField.value),
|
||||
output_lossless: outputLosslessField.checked,
|
||||
metadata_output_format: metadataOutputFormatField.value,
|
||||
use_gallery: useGalleryField.checked?GALLERY_NAME:null,
|
||||
original_prompt: promptField.value,
|
||||
active_tags: activeTags.map((x) => x.name),
|
||||
inactive_tags: activeTags.filter((tag) => tag.inactive === true).map((x) => x.name),
|
||||
@ -2008,6 +2010,7 @@ function onDimensionChange() {
|
||||
|
||||
diskPathField.disabled = !saveToDiskField.checked
|
||||
metadataOutputFormatField.disabled = !saveToDiskField.checked
|
||||
useGalleryField.disabled = !saveToDiskField.checked
|
||||
|
||||
gfpganModelField.disabled = !useFaceCorrectionField.checked
|
||||
useFaceCorrectionField.addEventListener("change", function(e) {
|
||||
@ -3273,7 +3276,12 @@ function layoutGallery() {
|
||||
|
||||
galleryModelSearchField.addEventListener("keyup", debounce(e => refreshGallery(true), 500))
|
||||
galleryPromptSearchField.addEventListener("keyup", debounce(e => refreshGallery(true), 500))
|
||||
|
||||
galleryPageField.addEventListener("keyup", e => {
|
||||
if (e.code === "Enter") {
|
||||
e.preventDefault()
|
||||
refreshGallery(false)
|
||||
}
|
||||
})
|
||||
|
||||
function refreshGallery(newsearch = false) {
|
||||
if (newsearch) {
|
||||
@ -3281,6 +3289,7 @@ function refreshGallery(newsearch = false) {
|
||||
}
|
||||
galleryImageContainer.innerHTML = ""
|
||||
let params = new URLSearchParams({
|
||||
workspace: GALLERY_NAME,
|
||||
prompt: galleryPromptSearchField.value,
|
||||
model: galleryModelSearchField.value,
|
||||
page: galleryPageField.value
|
||||
|
@ -97,6 +97,13 @@ var PARAMETERS = [
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "use_gallery",
|
||||
type: ParameterType.checkbox,
|
||||
label: "Save images to the gallery",
|
||||
note: "Stores metadata of all images into a database so that they show up on the gallery tab.",
|
||||
default: false,
|
||||
},
|
||||
{
|
||||
id: "block_nsfw",
|
||||
type: ParameterType.checkbox,
|
||||
@ -421,6 +428,7 @@ let uiOpenBrowserOnStartField = document.querySelector("#ui_open_browser_on_star
|
||||
let confirmDangerousActionsField = document.querySelector("#confirm_dangerous_actions")
|
||||
let testDiffusers = document.querySelector("#test_diffusers")
|
||||
let profileNameField = document.querySelector("#profileName")
|
||||
let useGalleryField = document.querySelector("#use_gallery")
|
||||
|
||||
let saveSettingsBtn = document.querySelector("#save-system-settings-btn")
|
||||
|
||||
@ -560,6 +568,7 @@ function applySettingsFromConfig(config) {
|
||||
saveToDiskField.addEventListener("change", function(e) {
|
||||
diskPathField.disabled = !this.checked
|
||||
metadataOutputFormatField.disabled = !this.checked
|
||||
useGalleryField.disabled = !this.checked
|
||||
})
|
||||
|
||||
function getCurrentRenderDeviceSelection() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user