diff --git a/ComfyUI/api_server/routes/internal/internal_routes.py b/ComfyUI/api_server/routes/internal/internal_routes.py index 613b0f7c..81fd5d67 100644 --- a/ComfyUI/api_server/routes/internal/internal_routes.py +++ b/ComfyUI/api_server/routes/internal/internal_routes.py @@ -4,6 +4,8 @@ from api_server.services.terminal_service import TerminalService import app.logger import os +from pathlib import Path +import subprocess class InternalRoutes: ''' @@ -43,7 +45,6 @@ async def subscribe_logs(request): return web.Response(status=200) - @self.routes.get('/folder_paths') async def get_folder_paths(request): response = {} @@ -64,10 +65,27 @@ async def get_files(request: web.Request) -> web.Response: ) return web.json_response([entry.name for entry in sorted_files], status=200) + # ✅ NEW: Generate Report Route + @self.routes.post('/generate_report') + async def generate_report(request): + try: + script_path = Path(__file__).parent.parent.parent / "utils" / "generate_report.py" + result = subprocess.run(["python", str(script_path)], capture_output=True, text=True, check=True) + return web.json_response({ + "status": "success", + "message": "Report generated successfully.", + "output": result.stdout + }) + except subprocess.CalledProcessError as e: + return web.json_response({ + "status": "error", + "message": "Report generation failed.", + "error": e.stderr + }, status=500) def get_app(self): if self._app is None: self._app = web.Application() self.setup_routes() self._app.add_routes(self.routes) - return self._app + return self._app \ No newline at end of file diff --git a/ComfyUI/tests-unit/report_bundle_test/test_generate_report.py b/ComfyUI/tests-unit/report_bundle_test/test_generate_report.py new file mode 100644 index 00000000..1380f153 --- /dev/null +++ b/ComfyUI/tests-unit/report_bundle_test/test_generate_report.py @@ -0,0 +1,29 @@ +import zipfile +import csv +from pathlib import Path + +def test_report_zip(): + base_dir = Path(__file__).resolve().parent.parent / "utils" + report_zip_path = base_dir / "report" / "report.zip" + + assert report_zip_path.exists(), "report.zip was not created." + + with zipfile.ZipFile(report_zip_path, 'r') as zipf: + names = zipf.namelist() + + # Check required files + assert "config.json" in names, "Missing config.json in ZIP" + assert "results.csv" in names, "Missing results.csv in ZIP" + assert "README.txt" in names, "Missing README.txt in ZIP" + + # Check image references in CSV exist in ZIP + with zipf.open("results.csv") as csvfile: + reader = csv.DictReader(line.decode('utf-8') for line in csvfile) + for row in reader: + image_name = f"grids/{row['image_file']}" + assert image_name in names, f"Missing image file {image_name} in ZIP" + + print("✅ All report.zip checks passed.") + +if __name__ == "__main__": + test_report_zip() \ No newline at end of file diff --git a/ComfyUI/user/default/comfy.settings.json b/ComfyUI/user/default/comfy.settings.json index 438b3dad..2fd34be2 100644 --- a/ComfyUI/user/default/comfy.settings.json +++ b/ComfyUI/user/default/comfy.settings.json @@ -1,3 +1,9 @@ { - "Comfy.TutorialCompleted": true + "Comfy.TutorialCompleted": true, + "Comfy.ColorPalette": "dark", + "Comfy.Release.Version": "0.3.49", + "Comfy.Release.Timestamp": 1754554707284, + "Comfy.NodeLibrary.Bookmarks.V2": [ + "KSamplerAdvanced" + ] } \ No newline at end of file diff --git a/ComfyUI/user/default/workflows/test.json b/ComfyUI/user/default/workflows/test.json new file mode 100644 index 00000000..a6e6abbf --- /dev/null +++ b/ComfyUI/user/default/workflows/test.json @@ -0,0 +1 @@ +{"id":"cc1b2b54-eec0-4305-ae97-16299b26e39a","revision":0,"last_node_id":12,"last_link_id":12,"nodes":[{"id":8,"type":"VAEDecode","pos":[1385.1756591796875,225.75196838378906],"size":[210,46],"flags":{},"order":5,"mode":0,"inputs":[{"localized_name":"samples","name":"samples","type":"LATENT","link":7},{"localized_name":"vae","name":"vae","type":"VAE","link":11}],"outputs":[{"localized_name":"IMAGE","name":"IMAGE","type":"IMAGE","slot_index":0,"links":[9]}],"properties":{"Node name for S&R":"VAEDecode"},"widgets_values":[]},{"id":5,"type":"EmptyLatentImage","pos":[488.48797607421875,706.76806640625],"size":[315,106],"flags":{},"order":0,"mode":0,"inputs":[{"localized_name":"width","name":"width","type":"INT","widget":{"name":"width"},"link":null},{"localized_name":"height","name":"height","type":"INT","widget":{"name":"height"},"link":null},{"localized_name":"batch_size","name":"batch_size","type":"INT","widget":{"name":"batch_size"},"link":null}],"outputs":[{"localized_name":"LATENT","name":"LATENT","type":"LATENT","slot_index":0,"links":[2]}],"properties":{"Node name for S&R":"EmptyLatentImage"},"widgets_values":[512,512,1]},{"id":7,"type":"CLIPTextEncode","pos":[413.4464416503906,393.6659240722656],"size":[425.27801513671875,180.6060791015625],"flags":{},"order":3,"mode":0,"inputs":[{"localized_name":"clip","name":"clip","type":"CLIP","link":10},{"localized_name":"text","name":"text","type":"STRING","widget":{"name":"text"},"link":null}],"outputs":[{"localized_name":"CONDITIONING","name":"CONDITIONING","type":"CONDITIONING","slot_index":0,"links":[6]}],"properties":{"Node name for S&R":"CLIPTextEncode"},"widgets_values":["text, watermark"],"color":"#323","bgcolor":"#535"},{"id":4,"type":"CheckpointLoaderSimple","pos":[12.355875015258789,538.53125],"size":[315,98],"flags":{},"order":1,"mode":0,"inputs":[{"localized_name":"ckpt_name","name":"ckpt_name","type":"COMBO","widget":{"name":"ckpt_name"},"link":null}],"outputs":[{"localized_name":"MODEL","name":"MODEL","type":"MODEL","slot_index":0,"links":[12]},{"localized_name":"CLIP","name":"CLIP","type":"CLIP","slot_index":1,"links":[3,10]},{"localized_name":"VAE","name":"VAE","type":"VAE","slot_index":2,"links":[11]}],"properties":{"Node name for S&R":"CheckpointLoaderSimple"},"widgets_values":["v1-5-pruned-emaonly.safetensors"]},{"id":9,"type":"SaveImage","pos":[1456.6739501953125,425.198486328125],"size":[210,270],"flags":{},"order":6,"mode":0,"inputs":[{"localized_name":"images","name":"images","type":"IMAGE","link":9},{"localized_name":"filename_prefix","name":"filename_prefix","type":"STRING","widget":{"name":"filename_prefix"},"link":null}],"outputs":[],"properties":{},"widgets_values":["ComfyUI"]},{"id":3,"type":"KSampler","pos":[1028.920166015625,474.3313293457031],"size":[315,262],"flags":{},"order":4,"mode":0,"inputs":[{"localized_name":"model","name":"model","type":"MODEL","link":12},{"localized_name":"positive","name":"positive","type":"CONDITIONING","link":4},{"localized_name":"negative","name":"negative","type":"CONDITIONING","link":6},{"localized_name":"latent_image","name":"latent_image","type":"LATENT","link":2},{"localized_name":"seed","name":"seed","type":"INT","widget":{"name":"seed"},"link":null},{"localized_name":"steps","name":"steps","type":"INT","widget":{"name":"steps"},"link":null},{"localized_name":"cfg","name":"cfg","type":"FLOAT","widget":{"name":"cfg"},"link":null},{"localized_name":"sampler_name","name":"sampler_name","type":"COMBO","widget":{"name":"sampler_name"},"link":null},{"localized_name":"scheduler","name":"scheduler","type":"COMBO","widget":{"name":"scheduler"},"link":null},{"localized_name":"denoise","name":"denoise","type":"FLOAT","widget":{"name":"denoise"},"link":null}],"outputs":[{"localized_name":"LATENT","name":"LATENT","type":"LATENT","slot_index":0,"links":[7]}],"properties":{"Node name for S&R":"KSampler"},"widgets_values":[157166686672613,"randomize",20,8,"euler","normal",1]},{"id":6,"type":"CLIPTextEncode","pos":[436.2958984375,132.760009765625],"size":[422.84503173828125,164.31304931640625],"flags":{},"order":2,"mode":0,"inputs":[{"localized_name":"clip","name":"clip","type":"CLIP","link":3},{"localized_name":"text","name":"text","type":"STRING","widget":{"name":"text"},"link":null}],"outputs":[{"localized_name":"CONDITIONING","name":"CONDITIONING","type":"CONDITIONING","slot_index":0,"links":[4]}],"properties":{"Node name for S&R":"CLIPTextEncode"},"widgets_values":["cute little golden retriever puppies"],"color":"#223","bgcolor":"#335"}],"links":[[2,5,0,3,3,"LATENT"],[3,4,1,6,0,"CLIP"],[4,6,0,3,1,"CONDITIONING"],[6,7,0,3,2,"CONDITIONING"],[7,3,0,8,0,"LATENT"],[9,8,0,9,0,"IMAGE"],[10,4,1,7,0,"CLIP"],[11,4,2,8,1,"VAE"],[12,4,0,3,0,"MODEL"]],"groups":[],"config":{},"extra":{"ds":{"scale":0.6115909044841489,"offset":[522.8425740808559,15.336086631059548]}},"version":0.4} \ No newline at end of file diff --git a/ComfyUI/utils/generate_report.py b/ComfyUI/utils/generate_report.py new file mode 100644 index 00000000..76ea8f28 --- /dev/null +++ b/ComfyUI/utils/generate_report.py @@ -0,0 +1,49 @@ +import os +import csv +import json +import zipfile +from pathlib import Path + +# Define paths +BASE_DIR = Path(__file__).parent +DATA_DIR = BASE_DIR / "sample_data" +REPORT_DIR = BASE_DIR / "report" +REPORT_ZIP = REPORT_DIR / "report.zip" +README_CONTENT = """# DreamLayer Inference Report + +This bundle contains: +- Inference results (results.csv) +- Configuration used (config.json) +- Grid images with seeds and parameters +""" + +def create_report(): + REPORT_DIR.mkdir(exist_ok=True) + + with zipfile.ZipFile(REPORT_ZIP, 'w', zipfile.ZIP_DEFLATED) as zipf: + # Add config.json + config_path = DATA_DIR / "config.json" + if config_path.exists(): + zipf.write(config_path, arcname="config.json") + + # Add results.csv and referenced images + results_path = DATA_DIR / "results.csv" + if results_path.exists(): + zipf.write(results_path, arcname="results.csv") + with open(results_path, newline='') as csvfile: + reader = csv.DictReader(csvfile) + for row in reader: + image_file = DATA_DIR / row["image_file"] + if image_file.exists(): + zipf.write(image_file, arcname=f"grids/{image_file.name}") + + # Add readme + readme_path = REPORT_DIR / "README.txt" + with open(readme_path, 'w') as f: + f.write(README_CONTENT) + zipf.write(readme_path, arcname="README.txt") + + print(f"Report generated at: {REPORT_ZIP.resolve()}") + +if __name__ == "__main__": + create_report() \ No newline at end of file diff --git a/ComfyUI/utils/report/README.txt b/ComfyUI/utils/report/README.txt new file mode 100644 index 00000000..af73dffd --- /dev/null +++ b/ComfyUI/utils/report/README.txt @@ -0,0 +1,6 @@ +# DreamLayer Inference Report + +This bundle contains: +- Inference results (results.csv) +- Configuration used (config.json) +- Grid images with seeds and parameters diff --git a/ComfyUI/utils/report/report.zip b/ComfyUI/utils/report/report.zip new file mode 100644 index 00000000..55895c82 Binary files /dev/null and b/ComfyUI/utils/report/report.zip differ diff --git a/ComfyUI/utils/report/report/README.txt b/ComfyUI/utils/report/report/README.txt new file mode 100644 index 00000000..af73dffd --- /dev/null +++ b/ComfyUI/utils/report/report/README.txt @@ -0,0 +1,6 @@ +# DreamLayer Inference Report + +This bundle contains: +- Inference results (results.csv) +- Configuration used (config.json) +- Grid images with seeds and parameters diff --git a/ComfyUI/utils/report/report/config.json b/ComfyUI/utils/report/report/config.json new file mode 100644 index 00000000..ea3ccaf2 --- /dev/null +++ b/ComfyUI/utils/report/report/config.json @@ -0,0 +1,385 @@ +{ + "id": "cc1b2b54-eec0-4305-ae97-16299b26e39a", + "revision": 0, + "last_node_id": 12, + "last_link_id": 12, + "nodes": [ + { + "id": 8, + "type": "VAEDecode", + "pos": [ + 1385.1756591796875, + 225.75196838378906 + ], + "size": [ + 210, + 46 + ], + "flags": {}, + "order": 5, + "mode": 0, + "inputs": [ + { + "name": "samples", + "type": "LATENT", + "link": 7 + }, + { + "name": "vae", + "type": "VAE", + "link": 11 + } + ], + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "slot_index": 0, + "links": [ + 9 + ] + } + ], + "properties": { + "Node name for S&R": "VAEDecode" + }, + "widgets_values": [] + }, + { + "id": 5, + "type": "EmptyLatentImage", + "pos": [ + 488.48797607421875, + 706.76806640625 + ], + "size": [ + 315, + 106 + ], + "flags": {}, + "order": 0, + "mode": 0, + "inputs": [], + "outputs": [ + { + "name": "LATENT", + "type": "LATENT", + "slot_index": 0, + "links": [ + 2 + ] + } + ], + "properties": { + "Node name for S&R": "EmptyLatentImage" + }, + "widgets_values": [ + 512, + 512, + 1 + ] + }, + { + "id": 7, + "type": "CLIPTextEncode", + "pos": [ + 413.4464416503906, + 393.6659240722656 + ], + "size": [ + 425.27801513671875, + 180.6060791015625 + ], + "flags": {}, + "order": 3, + "mode": 0, + "inputs": [ + { + "name": "clip", + "type": "CLIP", + "link": 10 + } + ], + "outputs": [ + { + "name": "CONDITIONING", + "type": "CONDITIONING", + "slot_index": 0, + "links": [ + 6 + ] + } + ], + "properties": { + "Node name for S&R": "CLIPTextEncode" + }, + "widgets_values": [ + "text, watermark" + ], + "color": "#323", + "bgcolor": "#535" + }, + { + "id": 4, + "type": "CheckpointLoaderSimple", + "pos": [ + 12.355875015258789, + 538.53125 + ], + "size": [ + 315, + 98 + ], + "flags": {}, + "order": 1, + "mode": 0, + "inputs": [], + "outputs": [ + { + "name": "MODEL", + "type": "MODEL", + "slot_index": 0, + "links": [ + 12 + ] + }, + { + "name": "CLIP", + "type": "CLIP", + "slot_index": 1, + "links": [ + 3, + 10 + ] + }, + { + "name": "VAE", + "type": "VAE", + "slot_index": 2, + "links": [ + 11 + ] + } + ], + "properties": { + "Node name for S&R": "CheckpointLoaderSimple" + }, + "widgets_values": [ + "v1-5-pruned-emaonly.safetensors" + ] + }, + { + "id": 9, + "type": "SaveImage", + "pos": [ + 1456.6739501953125, + 425.198486328125 + ], + "size": [ + 210, + 270 + ], + "flags": {}, + "order": 6, + "mode": 0, + "inputs": [ + { + "name": "images", + "type": "IMAGE", + "link": 9 + } + ], + "outputs": [], + "properties": {}, + "widgets_values": [ + "ComfyUI" + ] + }, + { + "id": 3, + "type": "KSampler", + "pos": [ + 1028.920166015625, + 474.3313293457031 + ], + "size": [ + 315, + 262 + ], + "flags": {}, + "order": 4, + "mode": 0, + "inputs": [ + { + "name": "model", + "type": "MODEL", + "link": 12 + }, + { + "name": "positive", + "type": "CONDITIONING", + "link": 4 + }, + { + "name": "negative", + "type": "CONDITIONING", + "link": 6 + }, + { + "name": "latent_image", + "type": "LATENT", + "link": 2 + } + ], + "outputs": [ + { + "name": "LATENT", + "type": "LATENT", + "slot_index": 0, + "links": [ + 7 + ] + } + ], + "properties": { + "Node name for S&R": "KSampler" + }, + "widgets_values": [ + 157166686672613, + "randomize", + 20, + 8, + "euler", + "normal", + 1 + ] + }, + { + "id": 6, + "type": "CLIPTextEncode", + "pos": [ + 436.2958984375, + 132.760009765625 + ], + "size": [ + 422.84503173828125, + 164.31304931640625 + ], + "flags": {}, + "order": 2, + "mode": 0, + "inputs": [ + { + "name": "clip", + "type": "CLIP", + "link": 3 + } + ], + "outputs": [ + { + "name": "CONDITIONING", + "type": "CONDITIONING", + "slot_index": 0, + "links": [ + 4 + ] + } + ], + "properties": { + "Node name for S&R": "CLIPTextEncode" + }, + "widgets_values": [ + "cute little golden retriever puppies" + ], + "color": "#223", + "bgcolor": "#335" + } + ], + "links": [ + [ + 2, + 5, + 0, + 3, + 3, + "LATENT" + ], + [ + 3, + 4, + 1, + 6, + 0, + "CLIP" + ], + [ + 4, + 6, + 0, + 3, + 1, + "CONDITIONING" + ], + [ + 6, + 7, + 0, + 3, + 2, + "CONDITIONING" + ], + [ + 7, + 3, + 0, + 8, + 0, + "LATENT" + ], + [ + 9, + 8, + 0, + 9, + 0, + "IMAGE" + ], + [ + 10, + 4, + 1, + 7, + 0, + "CLIP" + ], + [ + 11, + 4, + 2, + 8, + 1, + "VAE" + ], + [ + 12, + 4, + 0, + 3, + 0, + "MODEL" + ] + ], + "groups": [], + "config": {}, + "extra": { + "ds": { + "scale": 0.6115909044841497, + "offset": [ + 428.05346166719585, + 105.1594703132161 + ] + }, + "frontendVersion": "1.25.5" + }, + "version": 0.4 +} \ No newline at end of file diff --git a/ComfyUI/utils/report/report/grids/grid_001.png b/ComfyUI/utils/report/report/grids/grid_001.png new file mode 100644 index 00000000..a0574719 Binary files /dev/null and b/ComfyUI/utils/report/report/grids/grid_001.png differ diff --git a/ComfyUI/utils/report/report/grids/grid_002.png b/ComfyUI/utils/report/report/grids/grid_002.png new file mode 100644 index 00000000..2d154463 Binary files /dev/null and b/ComfyUI/utils/report/report/grids/grid_002.png differ diff --git a/ComfyUI/utils/report/report/results.csv b/ComfyUI/utils/report/report/results.csv new file mode 100644 index 00000000..88c5e2a0 --- /dev/null +++ b/ComfyUI/utils/report/report/results.csv @@ -0,0 +1,3 @@ +image_file,sampler,steps,cfg,seed +grid_001.png,euler,20,8.0,244011703599022 +grid_002.png,euler,20,8.0,157166686672613 \ No newline at end of file diff --git a/ComfyUI/utils/sample_data/config.json b/ComfyUI/utils/sample_data/config.json new file mode 100644 index 00000000..ea3ccaf2 --- /dev/null +++ b/ComfyUI/utils/sample_data/config.json @@ -0,0 +1,385 @@ +{ + "id": "cc1b2b54-eec0-4305-ae97-16299b26e39a", + "revision": 0, + "last_node_id": 12, + "last_link_id": 12, + "nodes": [ + { + "id": 8, + "type": "VAEDecode", + "pos": [ + 1385.1756591796875, + 225.75196838378906 + ], + "size": [ + 210, + 46 + ], + "flags": {}, + "order": 5, + "mode": 0, + "inputs": [ + { + "name": "samples", + "type": "LATENT", + "link": 7 + }, + { + "name": "vae", + "type": "VAE", + "link": 11 + } + ], + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "slot_index": 0, + "links": [ + 9 + ] + } + ], + "properties": { + "Node name for S&R": "VAEDecode" + }, + "widgets_values": [] + }, + { + "id": 5, + "type": "EmptyLatentImage", + "pos": [ + 488.48797607421875, + 706.76806640625 + ], + "size": [ + 315, + 106 + ], + "flags": {}, + "order": 0, + "mode": 0, + "inputs": [], + "outputs": [ + { + "name": "LATENT", + "type": "LATENT", + "slot_index": 0, + "links": [ + 2 + ] + } + ], + "properties": { + "Node name for S&R": "EmptyLatentImage" + }, + "widgets_values": [ + 512, + 512, + 1 + ] + }, + { + "id": 7, + "type": "CLIPTextEncode", + "pos": [ + 413.4464416503906, + 393.6659240722656 + ], + "size": [ + 425.27801513671875, + 180.6060791015625 + ], + "flags": {}, + "order": 3, + "mode": 0, + "inputs": [ + { + "name": "clip", + "type": "CLIP", + "link": 10 + } + ], + "outputs": [ + { + "name": "CONDITIONING", + "type": "CONDITIONING", + "slot_index": 0, + "links": [ + 6 + ] + } + ], + "properties": { + "Node name for S&R": "CLIPTextEncode" + }, + "widgets_values": [ + "text, watermark" + ], + "color": "#323", + "bgcolor": "#535" + }, + { + "id": 4, + "type": "CheckpointLoaderSimple", + "pos": [ + 12.355875015258789, + 538.53125 + ], + "size": [ + 315, + 98 + ], + "flags": {}, + "order": 1, + "mode": 0, + "inputs": [], + "outputs": [ + { + "name": "MODEL", + "type": "MODEL", + "slot_index": 0, + "links": [ + 12 + ] + }, + { + "name": "CLIP", + "type": "CLIP", + "slot_index": 1, + "links": [ + 3, + 10 + ] + }, + { + "name": "VAE", + "type": "VAE", + "slot_index": 2, + "links": [ + 11 + ] + } + ], + "properties": { + "Node name for S&R": "CheckpointLoaderSimple" + }, + "widgets_values": [ + "v1-5-pruned-emaonly.safetensors" + ] + }, + { + "id": 9, + "type": "SaveImage", + "pos": [ + 1456.6739501953125, + 425.198486328125 + ], + "size": [ + 210, + 270 + ], + "flags": {}, + "order": 6, + "mode": 0, + "inputs": [ + { + "name": "images", + "type": "IMAGE", + "link": 9 + } + ], + "outputs": [], + "properties": {}, + "widgets_values": [ + "ComfyUI" + ] + }, + { + "id": 3, + "type": "KSampler", + "pos": [ + 1028.920166015625, + 474.3313293457031 + ], + "size": [ + 315, + 262 + ], + "flags": {}, + "order": 4, + "mode": 0, + "inputs": [ + { + "name": "model", + "type": "MODEL", + "link": 12 + }, + { + "name": "positive", + "type": "CONDITIONING", + "link": 4 + }, + { + "name": "negative", + "type": "CONDITIONING", + "link": 6 + }, + { + "name": "latent_image", + "type": "LATENT", + "link": 2 + } + ], + "outputs": [ + { + "name": "LATENT", + "type": "LATENT", + "slot_index": 0, + "links": [ + 7 + ] + } + ], + "properties": { + "Node name for S&R": "KSampler" + }, + "widgets_values": [ + 157166686672613, + "randomize", + 20, + 8, + "euler", + "normal", + 1 + ] + }, + { + "id": 6, + "type": "CLIPTextEncode", + "pos": [ + 436.2958984375, + 132.760009765625 + ], + "size": [ + 422.84503173828125, + 164.31304931640625 + ], + "flags": {}, + "order": 2, + "mode": 0, + "inputs": [ + { + "name": "clip", + "type": "CLIP", + "link": 3 + } + ], + "outputs": [ + { + "name": "CONDITIONING", + "type": "CONDITIONING", + "slot_index": 0, + "links": [ + 4 + ] + } + ], + "properties": { + "Node name for S&R": "CLIPTextEncode" + }, + "widgets_values": [ + "cute little golden retriever puppies" + ], + "color": "#223", + "bgcolor": "#335" + } + ], + "links": [ + [ + 2, + 5, + 0, + 3, + 3, + "LATENT" + ], + [ + 3, + 4, + 1, + 6, + 0, + "CLIP" + ], + [ + 4, + 6, + 0, + 3, + 1, + "CONDITIONING" + ], + [ + 6, + 7, + 0, + 3, + 2, + "CONDITIONING" + ], + [ + 7, + 3, + 0, + 8, + 0, + "LATENT" + ], + [ + 9, + 8, + 0, + 9, + 0, + "IMAGE" + ], + [ + 10, + 4, + 1, + 7, + 0, + "CLIP" + ], + [ + 11, + 4, + 2, + 8, + 1, + "VAE" + ], + [ + 12, + 4, + 0, + 3, + 0, + "MODEL" + ] + ], + "groups": [], + "config": {}, + "extra": { + "ds": { + "scale": 0.6115909044841497, + "offset": [ + 428.05346166719585, + 105.1594703132161 + ] + }, + "frontendVersion": "1.25.5" + }, + "version": 0.4 +} \ No newline at end of file diff --git a/ComfyUI/utils/sample_data/grid_001.png b/ComfyUI/utils/sample_data/grid_001.png new file mode 100644 index 00000000..a0574719 Binary files /dev/null and b/ComfyUI/utils/sample_data/grid_001.png differ diff --git a/ComfyUI/utils/sample_data/grid_002.png b/ComfyUI/utils/sample_data/grid_002.png new file mode 100644 index 00000000..2d154463 Binary files /dev/null and b/ComfyUI/utils/sample_data/grid_002.png differ diff --git a/ComfyUI/utils/sample_data/results.csv b/ComfyUI/utils/sample_data/results.csv new file mode 100644 index 00000000..88c5e2a0 --- /dev/null +++ b/ComfyUI/utils/sample_data/results.csv @@ -0,0 +1,3 @@ +image_file,sampler,steps,cfg,seed +grid_001.png,euler,20,8.0,244011703599022 +grid_002.png,euler,20,8.0,157166686672613 \ No newline at end of file diff --git a/dream_layer_backend/dream_layer.py b/dream_layer_backend/dream_layer.py index f895cc6c..18f90a58 100644 --- a/dream_layer_backend/dream_layer.py +++ b/dream_layer_backend/dream_layer.py @@ -88,7 +88,7 @@ def get_directories() -> Tuple[str, Optional[str]]: sys.argv.extend(['--base-directory', models_dir]) # Check for environment variable to force ComfyUI CPU mode -if os.environ.get('DREAMLAYER_COMFYUI_CPU_MODE', 'false').lower() == 'true': +if True: print("Forcing ComfyUI to run in CPU mode as requested.") sys.argv.append('--cpu') @@ -323,6 +323,27 @@ def get_available_lora_models(): return formatted_models +@app.route('/api/generate-report', methods=['POST']) +def handle_generate_report(): + try: + script_path = os.path.join(os.path.dirname(__file__), '..\ComfyUI\utils\generate_report.py') + result = subprocess.run(["python", script_path], capture_output=True, text=True, check=True) + return jsonify({ + "status": "success", + "message": "Report generated successfully.", + "output": result.stdout + }) + except subprocess.CalledProcessError as e: + return jsonify({ + "status": "error", + "message": f"Failed to generate report: {e.stderr}" + }), 500 + except Exception as e: + return jsonify({ + "status": "error", + "message": f"Unexpected error: {str(e)}" + }), 500 + @app.route('/', methods=['GET']) def is_server_running(): diff --git a/dream_layer_frontend/src/components/GenerateReportButton.tsx b/dream_layer_frontend/src/components/GenerateReportButton.tsx new file mode 100644 index 00000000..94cd6ac3 --- /dev/null +++ b/dream_layer_frontend/src/components/GenerateReportButton.tsx @@ -0,0 +1,33 @@ +import React from "react"; + +const GenerateReportButton = () => { + const handleGenerateReport = async () => { + try { + const res = await fetch("http://localhost:5002/api/generate-report", { + method: "POST", + }); + + const data = await res.json(); + + if (data.status === "success") { + alert("Report generated successfully!"); + } else { + alert(`Report failed: ${data.message}`); + } + } catch (err) { + console.error("Error generating report:", err); + alert("Failed to connect to the backend."); + } + }; + + return ( + + ); +}; + +export default GenerateReportButton; \ No newline at end of file diff --git a/dream_layer_frontend/src/pages/Index.tsx b/dream_layer_frontend/src/pages/Index.tsx index 741c71be..6c97a08f 100644 --- a/dream_layer_frontend/src/pages/Index.tsx +++ b/dream_layer_frontend/src/pages/Index.tsx @@ -10,6 +10,7 @@ import { PNGInfoPage } from '@/features/PNGInfo'; import { ConfigurationsPage } from '@/features/Configurations'; import { useTxt2ImgGalleryStore } from '@/stores/useTxt2ImgGalleryStore'; import { useImg2ImgGalleryStore } from '@/stores/useImg2ImgGalleryStore'; +import GenerateReportButton from "../components/GenerateReportButton"; const Index = () => { const [activeTab, setActiveTab] = useState("txt2img"); @@ -55,6 +56,10 @@ const Index = () => {