diff --git a/.gitignore b/.gitignore index 1ee06ec..6dea479 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,5 @@ dist/ user_config.cfg output/ prompts_log.jsonl -publish.sh \ No newline at end of file +publish.sh +test.py diff --git a/ai_frame_image_server.py b/ai_frame_image_server.py index 2989357..7645adc 100644 --- a/ai_frame_image_server.py +++ b/ai_frame_image_server.py @@ -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"]) diff --git a/libs/generic.py b/libs/generic.py index da51c63..e51e411 100644 --- a/libs/generic.py +++ b/libs/generic.py @@ -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"] \ No newline at end of file diff --git a/templates/index.html b/templates/index.html index 77a987c..d4645d8 100644 --- a/templates/index.html +++ b/templates/index.html @@ -2,8 +2,8 @@
- - + +