Compare commits

...

4 Commits

Author SHA1 Message Date
1abba32f18 floating home button on gallery page 2025-05-17 11:38:23 +01:00
9d60135ab5 show version on the index page 2025-05-17 11:34:13 +01:00
ec6ab8123d Bump version to 0.1.3 2025-05-17 11:18:21 +01:00
be507d54e3 Bump version to 0.1.2 2025-05-17 11:16:25 +01:00
6 changed files with 57 additions and 16 deletions

View File

@ -1,5 +1,5 @@
[tool.bumpversion]
current_version = "0.1.1"
current_version = "0.1.3"
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
serialize = ["{major}.{minor}.{patch}"]
search = "{current_version}"

3
.gitignore vendored
View File

@ -7,4 +7,5 @@ dist/
user_config.cfg
output/
prompts_log.jsonl
publish.sh
publish.sh
test.py

View File

@ -9,7 +9,7 @@ import os
import time
import threading
from apscheduler.schedulers.background import BackgroundScheduler
from libs.generic import load_config, load_recent_prompts, get_details_from_png
from libs.generic import load_config, load_recent_prompts, get_details_from_png, get_current_version
from libs.comfyui import cancel_current_job, create_image
from libs.ollama import create_prompt_on_openwebui
@ -30,11 +30,14 @@ def index() -> str:
prompt = get_details_from_png(image_path)["p"]
version = get_current_version()
return render_template(
"index.html",
image=image_filename,
prompt=prompt,
reload_interval=user_config["frame"]["reload_interval"],
version=version
)
@app.route("/images", methods=["GET"])

View File

@ -1,3 +1,4 @@
import subprocess
import configparser
import logging
import sys
@ -81,6 +82,22 @@ def get_details_from_png(path):
print(f"Error reading metadata from {path}: {e}")
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
user_config = load_config()
output_folder = user_config["comfyui"]["output_dir"]

View File

@ -102,10 +102,13 @@
margin-top: 20px;
}
.button-group {
display: flex;
justify-content: center;
margin-top: 2rem;
/* Back button fixed top right */
.home-button {
position: fixed;
top: 20px;
right: 20px;
z-index: 500;
/* lower than lightbox (999) */
}
.button-link {
@ -166,15 +169,13 @@
</head>
<body>
<a href="/" class="button-link home-button">Home</a>
<h1>Image Archive</h1>
<!-- Empty gallery container; images will be loaded incrementally -->
<div class="gallery" id="gallery"></div>
<div class="button-group">
<a href="/" class="button-link">Back</a>
</div>
<!-- Lightbox -->
<div class="lightbox" id="lightbox">
<span class="close" onclick="closeLightbox()">&times;</span>
@ -198,7 +199,7 @@
const batchSize = 6; // images to load per batch
let loadedCount = 0;
let currentIndex = 0;
const detailsCache = {}; // Cache for image details
const detailsCache = {}; // Cache for image details
function createImageElement(image) {
const img = document.createElement('img');

View File

@ -2,8 +2,8 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>AI Image of the Day</title>
<style>
* {
@ -21,6 +21,7 @@
background: black;
color: white;
font-family: Arial, sans-serif;
position: relative; /* So fixed elements inside work well */
}
.image-container {
@ -74,6 +75,19 @@
.button-link:hover {
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;
}
</style>
<script>
setInterval(() => {
@ -85,7 +99,7 @@
<body>
{% if image %}
<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>
{% if prompt %}
<div class="prompt">{{ prompt }}</div>
@ -97,4 +111,9 @@
{% else %}
<p>No images found</p>
{% endif %}
</body>
<!-- Version number at bottom right -->
<div class="version">v{{ version }}</div>
</body>
</html>