mirror of
https://github.com/karl0ss/ai_image_frame_server.git
synced 2025-06-08 19:35:07 +01:00
Compare commits
50 Commits
Author | SHA1 | Date | |
---|---|---|---|
c7d71bfd03 | |||
1a0542861c | |||
0fc549c199 | |||
f7f049aacb | |||
669dad4044 | |||
c726d23707 | |||
2c9429d640 | |||
ac388b0f4e | |||
4272e1d40e | |||
4e1e240e30 | |||
3d2524c2ba | |||
52574de881 | |||
ef9bf72b84 | |||
0cd6c6c5c8 | |||
cd6b8a8d25 | |||
1aa540fa03 | |||
33bfee0220 | |||
f041a6afea | |||
336c03a888 | |||
9ce6ff25ea | |||
5be690f6c1 | |||
4da908d0da | |||
7adaaf4491 | |||
a75c7c554a | |||
2ff03fe101 | |||
4b52e5c713 | |||
2a9a226dd1 | |||
3f2c59c5bb | |||
55ccd71383 | |||
4b62b5cd07 | |||
b8322e1fd8 | |||
d749da148e | |||
d344674e02 | |||
b1646a4c6e | |||
0b74672844 | |||
aabd19dd5f | |||
423ca357f6 | |||
a7a27696d2 | |||
790c149c61 | |||
205481c4d4 | |||
80f535be45 | |||
1abba32f18 | |||
9d60135ab5 | |||
ec6ab8123d | |||
be507d54e3 | |||
bb641672f7 | |||
64d0c7bbab | |||
5b1fc11100 | |||
d9476a7d05 | |||
cd5306814c |
@ -1,10 +1,21 @@
|
|||||||
[bumpversion]
|
[tool.bumpversion]
|
||||||
current_version = "0.1.0"
|
current_version = "0.1.19"
|
||||||
commit = true
|
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
|
||||||
|
serialize = ["{major}.{minor}.{patch}"]
|
||||||
|
search = "{current_version}"
|
||||||
|
replace = "{new_version}"
|
||||||
|
regex = false
|
||||||
|
ignore_missing_version = false
|
||||||
|
ignore_missing_files = false
|
||||||
tag = true
|
tag = true
|
||||||
|
sign_tags = false
|
||||||
tag_name = "{new_version}"
|
tag_name = "{new_version}"
|
||||||
|
tag_message = "Bump version: {current_version} → {new_version}"
|
||||||
[[file]]
|
allow_dirty = false
|
||||||
filename = "__version__.py"
|
commit = true
|
||||||
parse = '__version__\s*=\s*"(?P<version>.*)"'
|
message = "Bump version: {current_version} → {new_version}"
|
||||||
serialize = '__version__ = "{new_version}"'
|
moveable_tags = []
|
||||||
|
commit_args = ""
|
||||||
|
setup_hooks = []
|
||||||
|
pre_commit_hooks = []
|
||||||
|
post_commit_hooks = []
|
||||||
|
43
.github/workflows/docker-publish.yml
vendored
43
.github/workflows/docker-publish.yml
vendored
@ -1,32 +1,19 @@
|
|||||||
name: Build, Update Version and Publish Docker Image
|
name: Build and Publish Docker Image
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [main]
|
tags: ["*"] # Only triggers on tag pushes
|
||||||
tags: ['*']
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-push:
|
build-and-push:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set up Python
|
|
||||||
uses: actions/setup-python@v4
|
|
||||||
with:
|
with:
|
||||||
python-version: '3.x'
|
fetch-depth: 0 # ensures tags are fetched
|
||||||
|
|
||||||
- name: Install bump2version
|
|
||||||
run: pip install bump2version
|
|
||||||
|
|
||||||
# Bump patch version, commit, and push back to repo (only on main branch)
|
|
||||||
- name: Bump version and push
|
|
||||||
if: github.ref == 'refs/heads/main'
|
|
||||||
run: |
|
|
||||||
bump2version patch --allow-dirty
|
|
||||||
git push origin main --follow-tags
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
@ -34,22 +21,20 @@ jobs:
|
|||||||
- name: Log in to Docker Registry
|
- name: Log in to Docker Registry
|
||||||
run: echo "${{ secrets.PASSWORD }}" | docker login ${{ secrets.REGISTRY }} -u "${{ secrets.USERNAME }}" --password-stdin
|
run: echo "${{ secrets.PASSWORD }}" | docker login ${{ secrets.REGISTRY }} -u "${{ secrets.USERNAME }}" --password-stdin
|
||||||
|
|
||||||
- name: Get version from file
|
|
||||||
id: get_version
|
|
||||||
run: |
|
|
||||||
VERSION=$(python -c "import myproject.__version__ as v; print(v.__version__)")
|
|
||||||
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: Build and Push Docker Images
|
- name: Build and Push Docker Images
|
||||||
run: |
|
run: |
|
||||||
IMAGE_NAME="ai-frame-image-server"
|
IMAGE_NAME="ai-frame-image-server"
|
||||||
REGISTRY="${{ secrets.REGISTRY }}"
|
REGISTRY="${{ secrets.REGISTRY }}"
|
||||||
USERNAME="${{ secrets.USERNAME }}"
|
USERNAME="${{ secrets.USERNAME }}"
|
||||||
VERSION="${{ steps.get_version.outputs.version }}"
|
GIT_TAG="${GITHUB_REF#refs/tags/}"
|
||||||
IMAGE_TAG="$REGISTRY/$USERNAME/$IMAGE_NAME:$VERSION"
|
IMAGE_TAGGED="$REGISTRY/$USERNAME/$IMAGE_NAME:$GIT_TAG"
|
||||||
|
IMAGE_LATEST="$REGISTRY/$USERNAME/$IMAGE_NAME:latest"
|
||||||
|
|
||||||
echo "🔧 Building $IMAGE_TAG"
|
echo "🔧 Building $IMAGE_TAGGED and $IMAGE_LATEST"
|
||||||
docker build -t $IMAGE_TAG .
|
docker build -t $IMAGE_LATEST -t $IMAGE_TAGGED .
|
||||||
|
|
||||||
echo "📤 Pushing $IMAGE_TAG"
|
echo "📤 Pushing $IMAGE_TAGGED"
|
||||||
docker push $IMAGE_TAG
|
docker push $IMAGE_TAGGED
|
||||||
|
|
||||||
|
echo "📤 Pushing $IMAGE_LATEST"
|
||||||
|
docker push $IMAGE_LATEST
|
||||||
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -8,3 +8,5 @@ user_config.cfg
|
|||||||
output/
|
output/
|
||||||
prompts_log.jsonl
|
prompts_log.jsonl
|
||||||
publish.sh
|
publish.sh
|
||||||
|
test.py
|
||||||
|
.vscode/launch.json
|
||||||
|
@ -1 +0,0 @@
|
|||||||
__version__ = "0.1.0"
|
|
@ -4,22 +4,35 @@ from flask import (
|
|||||||
send_from_directory,
|
send_from_directory,
|
||||||
request,
|
request,
|
||||||
jsonify,
|
jsonify,
|
||||||
|
redirect,
|
||||||
|
url_for,
|
||||||
|
session,
|
||||||
|
render_template_string,
|
||||||
)
|
)
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
import threading
|
import threading
|
||||||
from apscheduler.schedulers.background import BackgroundScheduler
|
from apscheduler.schedulers.background import BackgroundScheduler
|
||||||
from libs.generic import load_config, load_recent_prompts, get_details_from_png
|
from libs.generic import (
|
||||||
from libs.comfyui import cancel_current_job, create_image
|
load_config,
|
||||||
|
load_recent_prompts,
|
||||||
|
get_details_from_png,
|
||||||
|
get_current_version,
|
||||||
|
load_models_from_config,
|
||||||
|
)
|
||||||
|
from libs.comfyui import cancel_current_job, create_image, select_model
|
||||||
from libs.ollama import create_prompt_on_openwebui
|
from libs.ollama import create_prompt_on_openwebui
|
||||||
|
|
||||||
#workflow test commit
|
# workflow test commit
|
||||||
|
|
||||||
user_config = load_config()
|
user_config = load_config()
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
app.secret_key = os.environ.get('SECRET_KEY')
|
||||||
|
|
||||||
image_folder = "./output"
|
image_folder = "./output"
|
||||||
|
|
||||||
|
|
||||||
@app.route("/", methods=["GET"])
|
@app.route("/", methods=["GET"])
|
||||||
def index() -> str:
|
def index() -> str:
|
||||||
"""
|
"""
|
||||||
@ -30,20 +43,39 @@ def index() -> str:
|
|||||||
|
|
||||||
prompt = get_details_from_png(image_path)["p"]
|
prompt = get_details_from_png(image_path)["p"]
|
||||||
|
|
||||||
|
version = get_current_version()
|
||||||
|
|
||||||
return render_template(
|
return render_template(
|
||||||
"index.html",
|
"index.html",
|
||||||
image=image_filename,
|
image=image_filename,
|
||||||
prompt=prompt,
|
prompt=prompt,
|
||||||
reload_interval=user_config["frame"]["reload_interval"],
|
reload_interval=user_config["frame"]["reload_interval"],
|
||||||
|
version=version,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@app.route('/login', methods=['GET', 'POST'])
|
||||||
|
def login():
|
||||||
|
if request.method == 'POST':
|
||||||
|
if request.form['password'] == user_config["frame"]["password_for_auth"]:
|
||||||
|
session['authenticated'] = True
|
||||||
|
return render_template("create_image.html", models=load_models_from_config())
|
||||||
|
else:
|
||||||
|
return redirect(url_for('login'))
|
||||||
|
return render_template('login.html')
|
||||||
|
|
||||||
|
|
||||||
@app.route("/images", methods=["GET"])
|
@app.route("/images", methods=["GET"])
|
||||||
def gallery() -> str:
|
def gallery() -> str:
|
||||||
images = []
|
images = []
|
||||||
for f in os.listdir(image_folder):
|
for f in os.listdir(image_folder):
|
||||||
if f.lower().endswith(('png', 'jpg', 'jpeg', 'gif')):
|
if f.lower().endswith(("png", "jpg", "jpeg", "gif")):
|
||||||
images.append({'filename': f})
|
images.append({"filename": f})
|
||||||
images = sorted(images, key=lambda x: os.path.getmtime(os.path.join(image_folder, x['filename'])), reverse=True)
|
images = sorted(
|
||||||
|
images,
|
||||||
|
key=lambda x: os.path.getmtime(os.path.join(image_folder, x["filename"])),
|
||||||
|
reverse=True,
|
||||||
|
)
|
||||||
return render_template("gallery.html", images=images)
|
return render_template("gallery.html", images=images)
|
||||||
|
|
||||||
|
|
||||||
@ -53,15 +85,12 @@ def image_details(filename):
|
|||||||
if not os.path.exists(path):
|
if not os.path.exists(path):
|
||||||
return {"error": "File not found"}, 404
|
return {"error": "File not found"}, 404
|
||||||
details = get_details_from_png(path)
|
details = get_details_from_png(path)
|
||||||
return {
|
return {"prompt": details["p"], "model": details["m"], "date": details["d"]}
|
||||||
"prompt": details["p"],
|
|
||||||
"model": details["m"]
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@app.route('/images/thumbnails/<path:filename>')
|
@app.route("/images/thumbnails/<path:filename>")
|
||||||
def serve_thumbnail(filename):
|
def serve_thumbnail(filename):
|
||||||
return send_from_directory('output/thumbnails', filename)
|
return send_from_directory("output/thumbnails", filename)
|
||||||
|
|
||||||
|
|
||||||
@app.route("/images/<filename>", methods=["GET"])
|
@app.route("/images/<filename>", methods=["GET"])
|
||||||
@ -89,23 +118,30 @@ def cancel_job() -> None:
|
|||||||
|
|
||||||
|
|
||||||
@app.route("/create", methods=["GET", "POST"])
|
@app.route("/create", methods=["GET", "POST"])
|
||||||
def create() -> str:
|
def create():
|
||||||
"""Handles image creation requests.
|
if request.method == "POST":
|
||||||
Args:
|
prompt = request.form.get("prompt")
|
||||||
None
|
selected_workflow, model = select_model(request.form.get("model") or "Random")
|
||||||
Returns:
|
|
||||||
str: Redirect to the main page or a JSON response.
|
|
||||||
"""
|
|
||||||
prompt = request.form.get("prompt") if request.method == "POST" else None
|
|
||||||
|
|
||||||
if prompt is None:
|
if not prompt:
|
||||||
prompt = create_prompt_on_openwebui(user_config["comfyui"]["prompt"])
|
prompt = create_prompt_on_openwebui(user_config["comfyui"]["prompt"])
|
||||||
|
|
||||||
def create_image_in_background():
|
# Start generation in background
|
||||||
create_image(prompt)
|
threading.Thread(target=lambda: create_image(prompt, model)).start()
|
||||||
|
|
||||||
threading.Thread(target=create_image_in_background).start()
|
return redirect(
|
||||||
return render_template('image_queued.html', prompt=prompt)
|
url_for("image_queued", prompt=prompt, model=model.split(".")[0])
|
||||||
|
)
|
||||||
|
|
||||||
|
# For GET requests, just show the form to enter prompt
|
||||||
|
return render_template("create_image.html", models=load_models_from_config())
|
||||||
|
|
||||||
|
|
||||||
|
@app.route("/image_queued")
|
||||||
|
def image_queued():
|
||||||
|
prompt = request.args.get("prompt", "No prompt provided.")
|
||||||
|
model = request.args.get("model", "No model selected.").split(".")[0]
|
||||||
|
return render_template("image_queued.html", prompt=prompt, model=model)
|
||||||
|
|
||||||
|
|
||||||
def scheduled_task() -> None:
|
def scheduled_task() -> None:
|
||||||
@ -113,16 +149,17 @@ def scheduled_task() -> None:
|
|||||||
print(f"Executing scheduled task at {time.strftime('%Y-%m-%d %H:%M:%S')}")
|
print(f"Executing scheduled task at {time.strftime('%Y-%m-%d %H:%M:%S')}")
|
||||||
create_image(None)
|
create_image(None)
|
||||||
|
|
||||||
|
|
||||||
@app.route("/create_image", methods=["GET"])
|
@app.route("/create_image", methods=["GET"])
|
||||||
def create_image_endpoint() -> str:
|
def create_image_endpoint() -> str:
|
||||||
"""
|
"""
|
||||||
Renders the create image template with image and prompt.
|
Renders the create image template with image and prompt.
|
||||||
"""
|
"""
|
||||||
|
if user_config["frame"]["create_requires_auth"] == "True" and not session.get('authenticated'):
|
||||||
|
return redirect(url_for("login"))
|
||||||
|
models = load_models_from_config()
|
||||||
|
|
||||||
return render_template(
|
return render_template("create_image.html", models=models)
|
||||||
"create_image.html"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if user_config["frame"]["auto_regen"] == "True":
|
if user_config["frame"]["auto_regen"] == "True":
|
||||||
@ -136,10 +173,9 @@ if user_config["frame"]["auto_regen"] == "True":
|
|||||||
minute=regen_time[1],
|
minute=regen_time[1],
|
||||||
id="scheduled_task",
|
id="scheduled_task",
|
||||||
max_instances=1, # prevent overlapping
|
max_instances=1, # prevent overlapping
|
||||||
replace_existing=True # don't double-schedule
|
replace_existing=True, # don't double-schedule
|
||||||
)
|
)
|
||||||
scheduler.start()
|
scheduler.start()
|
||||||
|
|
||||||
os.makedirs(image_folder, exist_ok=True)
|
os.makedirs(image_folder, exist_ok=True)
|
||||||
app.run(host="0.0.0.0", port=user_config["frame"]["port"], debug=True)
|
app.run(host="0.0.0.0", port=user_config["frame"]["port"], debug=True)
|
||||||
|
|
||||||
|
55
d
55
d
@ -1,55 +0,0 @@
|
|||||||
[33mb0bb465[m[33m ([m[1;36mHEAD -> [m[1;32mmain[m[33m, [m[1;33mtag: 0.1.0[m[33m)[m add style for mobile
|
|
||||||
[33m4ec98eb[m working lazyloading
|
|
||||||
[33mc3f0a70[m working lightbox navifation with js cache for details
|
|
||||||
[33m636148b[m only load details when loading image in lightbox
|
|
||||||
[33mcf9f5d0[m cleanup and show modle name on gallery
|
|
||||||
[33mab1c0c3[m[33m ([m[1;31morigin/main[m[33m)[m fix SDXL workflow
|
|
||||||
[33m8be2111[m image queued page
|
|
||||||
[33m0ccebcf[m add back button to the bottom of the gallery
|
|
||||||
[33mda37913[m add create_image page
|
|
||||||
[33maef0afe[m wrong key name
|
|
||||||
[33me88d490[m fix the random model logic
|
|
||||||
[33mee18289[m yaml not sh
|
|
||||||
[33m1a3e657[m test commit to see if the workflow works
|
|
||||||
[33m26d9f38[m updated workflow
|
|
||||||
[33m2c5dbdb[m try create workflow to auto publish new container
|
|
||||||
[33me43ab87[m replace image.png thumbnail
|
|
||||||
[33m073cc3b[m update flux logic
|
|
||||||
[33m41fd144[m re working into libs, and use thumbs in gallery
|
|
||||||
[33m020c2c2[m updated styling and prompt on home page
|
|
||||||
[33m4acf28e[m update path for flux
|
|
||||||
[33m9aea4e6[m fix sorting and sdxl workflow prompt text
|
|
||||||
[33m81140d7[m updated logic to show prompt on the lightbox display
|
|
||||||
[33mcce1cb2[m lazy load images
|
|
||||||
[33mdcc6f94[m re-add topic logic
|
|
||||||
[33mb93d070[m update gitignore
|
|
||||||
[33m7c4ec9e[m Ignore publish.sh
|
|
||||||
[33m3e974d5[m fixed logic
|
|
||||||
[33meb59cfa[m wrong key
|
|
||||||
[33mb92366f[m spelling mistake
|
|
||||||
[33m60be7c4[m randomly select dev/schnell when using flux
|
|
||||||
[33mab50f2a[m add publish script
|
|
||||||
[33mc4b9dd2[m last 7 prompts not 7 days
|
|
||||||
[33m30d25d1[m rework to single flow
|
|
||||||
[33ma180a7b[m working flux and sdxl
|
|
||||||
[33m2bbb2fe[m allow flux workflow
|
|
||||||
[33m6fdfb51[m support multiple models and random selection
|
|
||||||
[33me4428b4[m return generated prompt, allow job to be cancelled
|
|
||||||
[33m91c48b5[m fix double running job
|
|
||||||
[33md32e903[m retry logic, create endpoint now non blocking
|
|
||||||
[33m42c8a2b[m sort gallery by new-old, move to -slim docker image
|
|
||||||
[33m5ab4d76[m strange indent
|
|
||||||
[33mdb9b961[m formatting and docstrings
|
|
||||||
[33mdcc0cdc[m move gallery to /images
|
|
||||||
[33m0838f37[m bigger gallery
|
|
||||||
[33m342416a[m arrow cycle
|
|
||||||
[33m6cc30bd[m add /gallery to show all generated images
|
|
||||||
[33m290c1ba[m support auto image regeneration at specific time
|
|
||||||
[33md97ef3f[m add support for multiple models and posting a prompt to /create
|
|
||||||
[33m0e471d7[m update negative prompt
|
|
||||||
[33m1fba2da[m docker compose file
|
|
||||||
[33m8064c90[m user config controls reload interval
|
|
||||||
[33m4fd857c[m fill as much as possible
|
|
||||||
[33m26e8d90[m add flask to requirements
|
|
||||||
[33mfc0b1f3[m update with docker server
|
|
||||||
[33m6ada0bf[m initial commit
|
|
@ -64,13 +64,14 @@ def generate_image(
|
|||||||
file_name: str,
|
file_name: str,
|
||||||
comfy_prompt: str,
|
comfy_prompt: str,
|
||||||
workflow_path: str = "./workflow_sdxl.json",
|
workflow_path: str = "./workflow_sdxl.json",
|
||||||
prompt_node: str = "CLIP Text Encode (Prompt)",
|
prompt_node: str = "Positive",
|
||||||
seed_node: str = "KSampler",
|
seed_node: str = "KSampler",
|
||||||
seed_param: str = "seed",
|
seed_param: str = "seed",
|
||||||
save_node: str = "Save Image",
|
save_node: str = "Save Image",
|
||||||
save_param: str = "filename_prefix",
|
save_param: str = "filename_prefix",
|
||||||
model_node: Optional[str] = "Load Checkpoint",
|
model_node: Optional[str] = "Load Checkpoint",
|
||||||
model_param: Optional[str] = "ckpt_name",
|
model_param: Optional[str] = "ckpt_name",
|
||||||
|
model: Optional[str] = "None",
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Generates an image using the Comfy API with configurable workflow settings."""
|
"""Generates an image using the Comfy API with configurable workflow settings."""
|
||||||
try:
|
try:
|
||||||
@ -100,21 +101,7 @@ def generate_image(
|
|||||||
user_config["comfyui"]["height"],
|
user_config["comfyui"]["height"],
|
||||||
)
|
)
|
||||||
|
|
||||||
# Conditionally set model if node and param are provided
|
wf.set_node_param(model_node, model_param, model)
|
||||||
if model_node and model_param:
|
|
||||||
if "FLUX" in workflow_path:
|
|
||||||
valid_models = user_config["comfyui:flux"]["models"].split(",")
|
|
||||||
else:
|
|
||||||
available_model_list = user_config["comfyui"]["models"].split(",")
|
|
||||||
valid_models = list(
|
|
||||||
set(get_available_models()) & set(available_model_list)
|
|
||||||
)
|
|
||||||
|
|
||||||
if not valid_models:
|
|
||||||
raise Exception("No valid models available.")
|
|
||||||
|
|
||||||
model = random.choice(valid_models)
|
|
||||||
wf.set_node_param(model_node, model_param, model)
|
|
||||||
|
|
||||||
# Generate image
|
# Generate image
|
||||||
logging.debug(f"Generating image: {file_name}")
|
logging.debug(f"Generating image: {file_name}")
|
||||||
@ -135,23 +122,40 @@ def generate_image(
|
|||||||
logging.error(f"Failed to generate image for UID: {file_name}. Error: {e}")
|
logging.error(f"Failed to generate image for UID: {file_name}. Error: {e}")
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
def select_model(model: str) -> tuple[str, str]:
|
||||||
|
use_flux = json.loads(user_config["comfyui"].get("FLUX", "false").lower())
|
||||||
|
only_flux = json.loads(user_config["comfyui"].get("ONLY_FLUX", "false").lower())
|
||||||
|
|
||||||
|
if model == "Random":
|
||||||
|
selected_workflow = "FLUX" if (use_flux and (only_flux or random.choice([True, False]))) else "SDXL"
|
||||||
|
elif "flux" in model.lower():
|
||||||
|
selected_workflow = "FLUX"
|
||||||
|
else:
|
||||||
|
selected_workflow = "SDXL"
|
||||||
|
|
||||||
|
if model == "Random":
|
||||||
|
if selected_workflow == "FLUX":
|
||||||
|
valid_models = user_config["comfyui:flux"]["models"].split(",")
|
||||||
|
else: # SDXL
|
||||||
|
available_model_list = user_config["comfyui"]["models"].split(",")
|
||||||
|
valid_models = list(set(get_available_models()) & set(available_model_list))
|
||||||
|
model = random.choice(valid_models)
|
||||||
|
|
||||||
|
return selected_workflow, model
|
||||||
|
|
||||||
|
|
||||||
|
def create_image(prompt: str | None = None, model: str = "Random") -> None:
|
||||||
|
"""Generate an image with a chosen workflow (Random, FLUX*, or SDXL*)."""
|
||||||
|
|
||||||
def create_image(prompt: str | None = None) -> None:
|
|
||||||
"""Main function for generating images."""
|
|
||||||
if prompt is None:
|
if prompt is None:
|
||||||
prompt = create_prompt_on_openwebui(user_config["comfyui"]["prompt"])
|
prompt = create_prompt_on_openwebui(user_config["comfyui"]["prompt"])
|
||||||
|
|
||||||
if not prompt:
|
if not prompt:
|
||||||
logging.error("No prompt generated.")
|
logging.error("No prompt generated.")
|
||||||
return
|
return
|
||||||
|
|
||||||
save_prompt(prompt)
|
save_prompt(prompt)
|
||||||
|
selected_workflow, model = select_model(model)
|
||||||
use_flux = json.loads((user_config["comfyui"].get("FLUX", False)).lower())
|
|
||||||
only_flux = json.loads((user_config["comfyui"].get("ONLY_FLUX", False)).lower())
|
|
||||||
|
|
||||||
selected_workflow = "SDXL"
|
|
||||||
if use_flux:
|
|
||||||
selected_workflow = "FLUX" if only_flux else random.choice(["FLUX", "SDXL"])
|
|
||||||
|
|
||||||
if selected_workflow == "FLUX":
|
if selected_workflow == "FLUX":
|
||||||
generate_image(
|
generate_image(
|
||||||
@ -163,12 +167,11 @@ def create_image(prompt: str | None = None) -> None:
|
|||||||
seed_param="seed",
|
seed_param="seed",
|
||||||
save_node="CivitAI Image Saver",
|
save_node="CivitAI Image Saver",
|
||||||
save_param="filename",
|
save_param="filename",
|
||||||
model_node="CivitAI Image Saver",
|
model_node="Unet Loader (GGUF)",
|
||||||
model_param="modelname",
|
model_param="unet_name",
|
||||||
|
model=model
|
||||||
)
|
)
|
||||||
else:
|
else: # SDXL
|
||||||
generate_image("image", prompt)
|
generate_image("image", comfy_prompt=prompt, model=model)
|
||||||
|
|
||||||
logging.info(f"{selected_workflow} generation started with prompt: {prompt}")
|
logging.info(f"{selected_workflow} generation started with prompt: {prompt}")
|
||||||
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
|||||||
|
import subprocess
|
||||||
import configparser
|
import configparser
|
||||||
import logging
|
import logging
|
||||||
import sys
|
import sys
|
||||||
@ -65,6 +66,7 @@ def rename_image() -> str | None:
|
|||||||
|
|
||||||
def get_details_from_png(path):
|
def get_details_from_png(path):
|
||||||
try:
|
try:
|
||||||
|
date = datetime.fromtimestamp(os.path.getctime(path)).strftime("%d-%m-%Y")
|
||||||
with Image.open(path) as img:
|
with Image.open(path) as img:
|
||||||
try:
|
try:
|
||||||
# Flux workflow
|
# Flux workflow
|
||||||
@ -76,11 +78,33 @@ def get_details_from_png(path):
|
|||||||
data = json.loads(img.info["prompt"])
|
data = json.loads(img.info["prompt"])
|
||||||
prompt = data['6']['inputs']['text']
|
prompt = data['6']['inputs']['text']
|
||||||
model = data['4']['inputs']['ckpt_name']
|
model = data['4']['inputs']['ckpt_name']
|
||||||
return {"p":prompt,"m":model} or {"p":"","m":""}
|
return {"p":prompt,"m":model,"d":date} or {"p":"","m":"","c":""}
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Error reading metadata from {path}: {e}")
|
print(f"Error reading metadata from {path}: {e}")
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
|
def get_current_version():
|
||||||
|
try:
|
||||||
|
# Run the command and capture the output
|
||||||
|
result = subprocess.run(
|
||||||
|
['bump-my-version', 'show', 'current_version'],
|
||||||
|
stdout=subprocess.PIPE,
|
||||||
|
stderr=subprocess.PIPE,
|
||||||
|
text=True, # to get string output instead of bytes
|
||||||
|
check=True # raises exception if command fails
|
||||||
|
)
|
||||||
|
version = result.stdout.strip()
|
||||||
|
return version
|
||||||
|
except subprocess.CalledProcessError as e:
|
||||||
|
print("Error running bump-my-version:", e)
|
||||||
|
return None
|
||||||
|
|
||||||
|
def load_models_from_config():
|
||||||
|
flux_models = user_config["comfyui:flux"]["models"].split(",")
|
||||||
|
sdxl_models = user_config["comfyui"]["models"].split(",")
|
||||||
|
all_models = flux_models + sdxl_models
|
||||||
|
return all_models
|
||||||
|
|
||||||
|
|
||||||
user_config = load_config()
|
user_config = load_config()
|
||||||
output_folder = user_config["comfyui"]["output_dir"]
|
output_folder = user_config["comfyui"]["output_dir"]
|
@ -24,13 +24,13 @@ def create_prompt_on_openwebui(prompt: str) -> str:
|
|||||||
topic_instruction = f" Incorporate the theme of '{selected_topic}' into the new prompt."
|
topic_instruction = f" Incorporate the theme of '{selected_topic}' into the new prompt."
|
||||||
|
|
||||||
user_content = (
|
user_content = (
|
||||||
"Here are the prompts from the last 7 days:\n\n"
|
"Can you generate me a really random image idea, Do not exceed 10 words. Use clear language, not poetic metaphors.”"
|
||||||
+ "\n".join(f"{i+1}. {p}" for i, p in enumerate(recent_prompts))
|
|
||||||
+ "\n\nDo not repeat ideas, themes, or settings from the above. "
|
|
||||||
"Now generate a new, completely original Stable Diffusion prompt that hasn't been done yet."
|
|
||||||
+ topic_instruction
|
+ topic_instruction
|
||||||
|
+ "Avoid prompts similar to the following:"
|
||||||
|
+ "\n".join(f"{i+1}. {p}" for i, p in enumerate(recent_prompts))
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
model = random.choice(user_config["openwebui"]["models"].split(","))
|
model = random.choice(user_config["openwebui"]["models"].split(","))
|
||||||
response = litellm.completion(
|
response = litellm.completion(
|
||||||
api_base=user_config["openwebui"]["base_url"],
|
api_base=user_config["openwebui"]["base_url"],
|
||||||
@ -67,4 +67,4 @@ def create_prompt_on_openwebui(prompt: str) -> str:
|
|||||||
# )
|
# )
|
||||||
# prompt = response["choices"][0]["message"]["content"].strip('"')
|
# prompt = response["choices"][0]["message"]["content"].strip('"')
|
||||||
logging.debug(prompt)
|
logging.debug(prompt)
|
||||||
return prompt
|
return prompt.split(": ")[-1]
|
@ -1,15 +1,19 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>Create An Image</title>
|
<title>Create An Image</title>
|
||||||
<style>
|
<style>
|
||||||
|
/* ---------- reset ---------- */
|
||||||
* {
|
* {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ---------- layout ---------- */
|
||||||
body {
|
body {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
@ -21,6 +25,7 @@
|
|||||||
font-family: Arial, sans-serif;
|
font-family: Arial, sans-serif;
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
textarea {
|
textarea {
|
||||||
width: 80vw;
|
width: 80vw;
|
||||||
height: 200px;
|
height: 200px;
|
||||||
@ -34,11 +39,15 @@
|
|||||||
color: #eee;
|
color: #eee;
|
||||||
border: 1px solid #333;
|
border: 1px solid #333;
|
||||||
}
|
}
|
||||||
|
|
||||||
.button-group {
|
.button-group {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 20px;
|
gap: 20px;
|
||||||
|
align-items: center;
|
||||||
}
|
}
|
||||||
button {
|
|
||||||
|
button,
|
||||||
|
select {
|
||||||
background: #333;
|
background: #333;
|
||||||
color: white;
|
color: white;
|
||||||
border: none;
|
border: none;
|
||||||
@ -48,42 +57,150 @@
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: background 0.3s;
|
transition: background 0.3s;
|
||||||
}
|
}
|
||||||
button:hover {
|
|
||||||
|
button:hover,
|
||||||
|
select:hover {
|
||||||
background: #555;
|
background: #555;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ---------- spinner ---------- */
|
||||||
|
#spinner-overlay {
|
||||||
|
position: fixed;
|
||||||
|
inset: 0;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
background: rgba(0, 0, 0, 0.6);
|
||||||
|
visibility: hidden;
|
||||||
|
z-index: 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.spinner {
|
||||||
|
width: 50px;
|
||||||
|
height: 50px;
|
||||||
|
border: 6px solid #555;
|
||||||
|
border-top-color: white;
|
||||||
|
border-radius: 50%;
|
||||||
|
animation: spin 0.8s linear infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes spin {
|
||||||
|
to {
|
||||||
|
transform: rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 600px) {
|
||||||
|
body {
|
||||||
|
min-height: 100dvh;
|
||||||
|
height: auto;
|
||||||
|
justify-content: flex-start;
|
||||||
|
padding-top: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button-group {
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: stretch;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
button,
|
||||||
|
select {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
textarea {
|
||||||
|
height: 150px;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<h1 style="margin-bottom: 20px;">Create An Image</h1>
|
<h1 style="margin-bottom: 20px;">Create An Image</h1>
|
||||||
|
|
||||||
<textarea id="prompt-box" placeholder="Enter your custom prompt here..."></textarea>
|
<textarea id="prompt-box" placeholder="Enter your custom prompt here..."></textarea>
|
||||||
|
|
||||||
<div class="button-group">
|
<div class="button-group">
|
||||||
<button onclick="location.href='/'">Back</button>
|
<button onclick="showSpinner(); location.href='/'">Back</button>
|
||||||
|
|
||||||
<button onclick="sendPrompt()">Send Prompt</button>
|
<button onclick="sendPrompt()">Send Prompt</button>
|
||||||
<button onclick="location.href='/create'">Random Prompt</button>
|
|
||||||
|
<button onclick="randomPrompt()">Random Prompt</button>
|
||||||
|
|
||||||
|
<select id="model-select">
|
||||||
|
<option value="" selected>Random</option>
|
||||||
|
<!-- Group: FLUX -->
|
||||||
|
<optgroup label="FLUX">
|
||||||
|
{% for m in models if 'flux' in m|lower %}
|
||||||
|
<option value="{{ m }}">{{ m.rsplit('.', 1)[0] }}</option>
|
||||||
|
{% endfor %}
|
||||||
|
</optgroup>
|
||||||
|
<!-- Group: SDXL -->
|
||||||
|
<optgroup label="SDXL">
|
||||||
|
{% for m in models if 'flux' not in m|lower %}
|
||||||
|
<option value="{{ m }}">{{ m.rsplit('.', 1)[0] }}</option>
|
||||||
|
{% endfor %}
|
||||||
|
</optgroup>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- waiting overlay -->
|
||||||
|
<div id="spinner-overlay">
|
||||||
|
<div class="spinner"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
const overlay = document.getElementById('spinner-overlay');
|
||||||
|
|
||||||
|
function showSpinner() { overlay.style.visibility = 'visible'; }
|
||||||
|
|
||||||
function sendPrompt() {
|
function sendPrompt() {
|
||||||
|
showSpinner();
|
||||||
const prompt = document.getElementById('prompt-box').value;
|
const prompt = document.getElementById('prompt-box').value;
|
||||||
|
const model = document.getElementById('model-select').value;
|
||||||
|
|
||||||
const formData = new URLSearchParams();
|
const formData = new URLSearchParams();
|
||||||
formData.append('prompt', prompt);
|
formData.append('prompt', prompt);
|
||||||
|
formData.append('model', model);
|
||||||
|
|
||||||
fetch('/create', {
|
fetch('/create', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||||
'Content-Type': 'application/x-www-form-urlencoded',
|
|
||||||
},
|
|
||||||
body: formData.toString()
|
body: formData.toString()
|
||||||
}).then(response => {
|
})
|
||||||
if (response.redirected) {
|
.then(response => {
|
||||||
window.location.href = response.url;
|
window.location.href = response.redirected ? response.url : '/create';
|
||||||
} else {
|
})
|
||||||
alert("Image creation request sent.");
|
.catch(error => {
|
||||||
}
|
overlay.style.visibility = 'hidden';
|
||||||
}).catch(error => {
|
alert("Error sending prompt: " + error);
|
||||||
alert("Error sending prompt: " + error);
|
});
|
||||||
});
|
}
|
||||||
|
|
||||||
|
// wrapper for Random Prompt button so it also sends the model
|
||||||
|
function randomPrompt() {
|
||||||
|
showSpinner();
|
||||||
|
const model = document.getElementById('model-select').value;
|
||||||
|
|
||||||
|
const formData = new URLSearchParams();
|
||||||
|
formData.append('model', model);
|
||||||
|
|
||||||
|
fetch('/create', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||||
|
body: formData.toString()
|
||||||
|
})
|
||||||
|
.then(response => {
|
||||||
|
window.location.href = response.redirected ? response.url : '/create';
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
overlay.style.visibility = 'hidden';
|
||||||
|
alert("Error requesting random prompt: " + error);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
@ -55,6 +55,7 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
z-index: 999;
|
z-index: 999;
|
||||||
|
padding: 20px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.lightbox img {
|
.lightbox img {
|
||||||
@ -100,12 +101,19 @@
|
|||||||
max-width: 80%;
|
max-width: 80%;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
margin-top: 20px;
|
margin-top: 20px;
|
||||||
|
max-height: 25vh;
|
||||||
|
/* NEW: restrict height */
|
||||||
|
overflow-y: auto;
|
||||||
|
/* NEW: allow vertical scroll */
|
||||||
}
|
}
|
||||||
|
|
||||||
.button-group {
|
/* Back button fixed top right */
|
||||||
display: flex;
|
.home-button {
|
||||||
justify-content: center;
|
position: fixed;
|
||||||
margin-top: 2rem;
|
top: 20px;
|
||||||
|
right: 20px;
|
||||||
|
z-index: 500;
|
||||||
|
/* lower than lightbox (999) */
|
||||||
}
|
}
|
||||||
|
|
||||||
.button-link {
|
.button-link {
|
||||||
@ -155,6 +163,10 @@
|
|||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
max-width: 90%;
|
max-width: 90%;
|
||||||
padding: 8px 16px;
|
padding: 8px 16px;
|
||||||
|
max-height: 20vh;
|
||||||
|
/* smaller height for mobile */
|
||||||
|
overflow-y: auto;
|
||||||
|
/* keep scroll on mobile too */
|
||||||
}
|
}
|
||||||
|
|
||||||
.button-link {
|
.button-link {
|
||||||
@ -166,15 +178,13 @@
|
|||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
<a href="/" class="button-link home-button">Home</a>
|
||||||
|
|
||||||
<h1>Image Archive</h1>
|
<h1>Image Archive</h1>
|
||||||
|
|
||||||
<!-- Empty gallery container; images will be loaded incrementally -->
|
<!-- Empty gallery container; images will be loaded incrementally -->
|
||||||
<div class="gallery" id="gallery"></div>
|
<div class="gallery" id="gallery"></div>
|
||||||
|
|
||||||
<div class="button-group">
|
|
||||||
<a href="/" class="button-link">Back</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Lightbox -->
|
<!-- Lightbox -->
|
||||||
<div class="lightbox" id="lightbox">
|
<div class="lightbox" id="lightbox">
|
||||||
<span class="close" onclick="closeLightbox()">×</span>
|
<span class="close" onclick="closeLightbox()">×</span>
|
||||||
@ -195,10 +205,10 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
const gallery = document.getElementById('gallery');
|
const gallery = document.getElementById('gallery');
|
||||||
const batchSize = 6; // images to load per batch
|
const batchSize = 9; // images to load per batch
|
||||||
let loadedCount = 0;
|
let loadedCount = 0;
|
||||||
let currentIndex = 0;
|
let currentIndex = 0;
|
||||||
const detailsCache = {}; // Cache for image details
|
const detailsCache = {}; // Cache for image details
|
||||||
|
|
||||||
function createImageElement(image) {
|
function createImageElement(image) {
|
||||||
const img = document.createElement('img');
|
const img = document.createElement('img');
|
||||||
@ -254,7 +264,8 @@
|
|||||||
|
|
||||||
if (detailsCache[filename]) {
|
if (detailsCache[filename]) {
|
||||||
document.getElementById("lightbox-prompt").textContent =
|
document.getElementById("lightbox-prompt").textContent =
|
||||||
`Model: ${detailsCache[filename].model}\n\n${detailsCache[filename].prompt}`;
|
`Model:${detailsCache[filename].model} - Created:${detailsCache[filename].date}\n\n${detailsCache[filename].prompt}`;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
document.getElementById("lightbox-prompt").textContent = "Loading…";
|
document.getElementById("lightbox-prompt").textContent = "Loading…";
|
||||||
|
|
||||||
@ -266,7 +277,7 @@
|
|||||||
.then(data => {
|
.then(data => {
|
||||||
detailsCache[filename] = data; // Cache the data
|
detailsCache[filename] = data; // Cache the data
|
||||||
document.getElementById("lightbox-prompt").textContent =
|
document.getElementById("lightbox-prompt").textContent =
|
||||||
`Model: ${data.model}\n\n${data.prompt}`;
|
`Model:${data.model} - Created:${data.date}\n\n${data.prompt}`;
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
document.getElementById("lightbox-prompt").textContent = "Couldn’t load details.";
|
document.getElementById("lightbox-prompt").textContent = "Couldn’t load details.";
|
||||||
@ -276,8 +287,17 @@
|
|||||||
|
|
||||||
function nextImage() {
|
function nextImage() {
|
||||||
const images = getGalleryImages();
|
const images = getGalleryImages();
|
||||||
currentIndex = (currentIndex + 1) % images.length;
|
if (currentIndex + 1 >= images.length && loadedCount < allImages.length) {
|
||||||
showImageAndLoadDetails(currentIndex);
|
loadNextBatch();
|
||||||
|
// Wait briefly to ensure DOM updates
|
||||||
|
setTimeout(() => {
|
||||||
|
currentIndex++;
|
||||||
|
showImageAndLoadDetails(currentIndex);
|
||||||
|
}, 100);
|
||||||
|
} else {
|
||||||
|
currentIndex = (currentIndex + 1) % images.length;
|
||||||
|
showImageAndLoadDetails(currentIndex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function prevImage() {
|
function prevImage() {
|
||||||
@ -286,6 +306,7 @@
|
|||||||
showImageAndLoadDetails(currentIndex);
|
showImageAndLoadDetails(currentIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function closeLightbox() {
|
function closeLightbox() {
|
||||||
document.getElementById("lightbox").style.display = "none";
|
document.getElementById("lightbox").style.display = "none";
|
||||||
}
|
}
|
||||||
|
@ -52,10 +52,11 @@
|
|||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="message">Image will be made using prompt:</div>
|
<div class="message">Image will be made with <i>{{ model }}</i> using prompt:</div>
|
||||||
<div class="prompt-text">
|
<div class="prompt-text">
|
||||||
{{ prompt }}
|
{{ prompt }}
|
||||||
</div>
|
</div>
|
||||||
<button onclick="location.href='/'">Home</button>
|
<button onclick="location.href='/'">Home</button>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>AI Image of the Day</title>
|
<title>AI Image of the Day</title>
|
||||||
<style>
|
<style>
|
||||||
* {
|
* {
|
||||||
@ -21,8 +21,12 @@
|
|||||||
background: black;
|
background: black;
|
||||||
color: white;
|
color: white;
|
||||||
font-family: Arial, sans-serif;
|
font-family: Arial, sans-serif;
|
||||||
|
position: relative;
|
||||||
|
padding-top: 20px;
|
||||||
|
padding-bottom: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.image-container {
|
.image-container {
|
||||||
max-width: 90vw;
|
max-width: 90vw;
|
||||||
max-height: 80vh;
|
max-height: 80vh;
|
||||||
@ -49,6 +53,10 @@
|
|||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
max-width: 80vw;
|
max-width: 80vw;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
|
max-height: 30vh;
|
||||||
|
/* NEW: limit height */
|
||||||
|
overflow-y: auto;
|
||||||
|
/* NEW: allow scrolling */
|
||||||
}
|
}
|
||||||
|
|
||||||
.button-group {
|
.button-group {
|
||||||
@ -74,6 +82,47 @@
|
|||||||
.button-link:hover {
|
.button-link:hover {
|
||||||
background: #555;
|
background: #555;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* New style for version number */
|
||||||
|
.version {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 8px;
|
||||||
|
right: 12px;
|
||||||
|
color: #666;
|
||||||
|
font-size: 12px;
|
||||||
|
font-family: monospace;
|
||||||
|
user-select: none;
|
||||||
|
pointer-events: none;
|
||||||
|
opacity: 0.6;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.image-container {
|
||||||
|
max-width: 100vw;
|
||||||
|
max-height: 50vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
img {
|
||||||
|
max-width: 100%;
|
||||||
|
max-height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.prompt {
|
||||||
|
max-height: 20vh;
|
||||||
|
font-size: 14px;
|
||||||
|
padding: 10px 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button-group {
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button-link {
|
||||||
|
font-size: 14px;
|
||||||
|
padding: 8px 16px;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
@ -85,7 +134,7 @@
|
|||||||
<body>
|
<body>
|
||||||
{% if image %}
|
{% if image %}
|
||||||
<div class="image-container">
|
<div class="image-container">
|
||||||
<img src="{{ url_for('images', filename=image) }}" alt="Latest Image">
|
<img src="{{ url_for('images', filename=image) }}" alt="Latest Image" />
|
||||||
</div>
|
</div>
|
||||||
{% if prompt %}
|
{% if prompt %}
|
||||||
<div class="prompt">{{ prompt }}</div>
|
<div class="prompt">{{ prompt }}</div>
|
||||||
@ -97,4 +146,9 @@
|
|||||||
{% else %}
|
{% else %}
|
||||||
<p>No images found</p>
|
<p>No images found</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
<!-- Version number at bottom right -->
|
||||||
|
<div class="version">v{{ version }}</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
</html>
|
72
templates/login.html
Normal file
72
templates/login.html
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Login</title>
|
||||||
|
<style>
|
||||||
|
* {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
body {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
height: 100vh;
|
||||||
|
background: black;
|
||||||
|
color: white;
|
||||||
|
font-family: Arial, sans-serif;
|
||||||
|
padding: 20px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.message {
|
||||||
|
font-size: 22px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
.prompt-text {
|
||||||
|
font-size: 20px;
|
||||||
|
background: #111;
|
||||||
|
padding: 20px;
|
||||||
|
border-radius: 10px;
|
||||||
|
border: 1px solid #333;
|
||||||
|
max-width: 80vw;
|
||||||
|
margin-bottom: 30px;
|
||||||
|
}
|
||||||
|
input[type="password"] {
|
||||||
|
padding: 10px;
|
||||||
|
border-radius: 8px;
|
||||||
|
border: 1px solid #555;
|
||||||
|
background: #222;
|
||||||
|
color: white;
|
||||||
|
font-size: 16px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
width: 250px;
|
||||||
|
}
|
||||||
|
button {
|
||||||
|
background: #333;
|
||||||
|
color: white;
|
||||||
|
border: none;
|
||||||
|
padding: 10px 20px;
|
||||||
|
border-radius: 8px;
|
||||||
|
font-size: 16px;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: background 0.3s;
|
||||||
|
}
|
||||||
|
button:hover {
|
||||||
|
background: #555;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="message">Please enter the password to continue:</div>
|
||||||
|
<form method="post">
|
||||||
|
<div class="prompt-text">
|
||||||
|
<input type="password" name="password" placeholder="Password" required>
|
||||||
|
</div>
|
||||||
|
<button type="submit">Login</button>
|
||||||
|
</form>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -3,6 +3,8 @@ reload_interval = 30000
|
|||||||
auto_regen = True
|
auto_regen = True
|
||||||
regen_time = 03:00
|
regen_time = 03:00
|
||||||
port = 5000
|
port = 5000
|
||||||
|
create_requires_auth = False
|
||||||
|
password_for_auth = create
|
||||||
|
|
||||||
[comfyui]
|
[comfyui]
|
||||||
comfyui_url = http://comfyui
|
comfyui_url = http://comfyui
|
||||||
|
@ -59,7 +59,7 @@
|
|||||||
},
|
},
|
||||||
"class_type": "CLIPTextEncode",
|
"class_type": "CLIPTextEncode",
|
||||||
"_meta": {
|
"_meta": {
|
||||||
"title": "CLIP Text Encode (Prompt)"
|
"title": "Positive"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"7": {
|
"7": {
|
||||||
@ -72,7 +72,7 @@
|
|||||||
},
|
},
|
||||||
"class_type": "CLIPTextEncode",
|
"class_type": "CLIPTextEncode",
|
||||||
"_meta": {
|
"_meta": {
|
||||||
"title": "CLIP Text Encode (Prompt)"
|
"title": "Negative"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"8": {
|
"8": {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user