mirror of
https://github.com/karl0ss/ai_image_frame_server.git
synced 2025-09-09 15:53:16 +01:00
Compare commits
4 Commits
b8322e1fd8
...
2a9a226dd1
Author | SHA1 | Date | |
---|---|---|---|
2a9a226dd1 | |||
3f2c59c5bb | |||
55ccd71383 | |||
4b62b5cd07 |
@ -1,5 +1,5 @@
|
|||||||
[tool.bumpversion]
|
[tool.bumpversion]
|
||||||
current_version = "0.1.8"
|
current_version = "0.1.9"
|
||||||
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
|
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
|
||||||
serialize = ["{major}.{minor}.{patch}"]
|
serialize = ["{major}.{minor}.{patch}"]
|
||||||
search = "{current_version}"
|
search = "{current_version}"
|
||||||
|
@ -4,6 +4,8 @@ from flask import (
|
|||||||
send_from_directory,
|
send_from_directory,
|
||||||
request,
|
request,
|
||||||
jsonify,
|
jsonify,
|
||||||
|
redirect,
|
||||||
|
url_for
|
||||||
)
|
)
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
@ -92,26 +94,28 @@ 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
|
model = request.form.get("model", "Random")
|
||||||
Returns:
|
|
||||||
str: Redirect to the main page or a JSON response.
|
if not prompt:
|
||||||
"""
|
prompt = create_prompt_on_openwebui(user_config["comfyui"]["prompt"])
|
||||||
prompt = request.form.get("prompt") if request.method == "POST" else None
|
|
||||||
model = request.form.get("model") if request.method == "POST" else "Random"
|
# Start generation in background
|
||||||
|
threading.Thread(target=lambda: create_image(prompt, model)).start()
|
||||||
|
|
||||||
|
# store prompt in query string temporarily
|
||||||
|
return redirect(url_for("image_queued", prompt=prompt))
|
||||||
|
|
||||||
|
# For GET requests, just show the form to enter prompt
|
||||||
|
return render_template("create_image.html", models=load_models_from_config())
|
||||||
|
|
||||||
|
|
||||||
if prompt is None:
|
@app.route("/image_queued")
|
||||||
prompt = create_prompt_on_openwebui(user_config["comfyui"]["prompt"])
|
def image_queued():
|
||||||
|
prompt = request.args.get("prompt", "No prompt provided.")
|
||||||
def create_image_in_background():
|
return render_template("image_queued.html", prompt=prompt)
|
||||||
create_image(prompt, model)
|
|
||||||
|
|
||||||
threading.Thread(target=create_image_in_background).start()
|
|
||||||
return render_template('image_queued.html', prompt=prompt)
|
|
||||||
|
|
||||||
|
|
||||||
def scheduled_task() -> None:
|
def scheduled_task() -> None:
|
||||||
"""Executes the scheduled image generation task."""
|
"""Executes the scheduled image generation task."""
|
||||||
|
@ -64,7 +64,7 @@ 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",
|
||||||
|
@ -57,15 +57,6 @@
|
|||||||
/* NEW: allow scrolling */
|
/* NEW: allow scrolling */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Optional: Adjust height for smaller screens */
|
|
||||||
@media (max-width: 768px) {
|
|
||||||
.prompt {
|
|
||||||
max-height: 25vh;
|
|
||||||
/* even smaller on mobile */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.button-group {
|
.button-group {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 20px;
|
gap: 20px;
|
||||||
@ -102,6 +93,34 @@
|
|||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
opacity: 0.6;
|
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(() => {
|
||||||
|
@ -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