Skip to content

Commit 526309a

Browse files
committed
Added links in Misc tab
1 parent 551e8b5 commit 526309a

File tree

3 files changed

+29
-3
lines changed

3 files changed

+29
-3
lines changed

modules/util.py

+16-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import datetime
1+
from datetime import datetime, timedelta
22
import random
33
import os
44

55

66
def generate_temp_filename(folder='./outputs/', extension='png', base=None):
7-
current_time = datetime.datetime.now()
7+
current_time = datetime.now()
88
date_string = current_time.strftime("%Y-%m-%d")
99
if base == None:
1010
time_string = current_time.strftime("%Y-%m-%d_%H-%M-%S")
@@ -14,3 +14,17 @@ def generate_temp_filename(folder='./outputs/', extension='png', base=None):
1414
filename = f"{os.path.splitext(base)[0]}.{extension}"
1515
result = os.path.join(folder, date_string, filename)
1616
return date_string, os.path.abspath(os.path.realpath(result)), filename
17+
18+
19+
def get_log_path(time, folder='./outputs/'):
20+
return os.path.join(folder, time.strftime("%Y-%m-%d"), 'log.html')
21+
22+
23+
def get_current_log_path():
24+
time = datetime.now()
25+
return get_log_path(time)
26+
27+
28+
def get_previous_log_path():
29+
time = datetime.now() - timedelta(days=1)
30+
return get_log_path(time)

update_log_mre.md

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Added support for reading styles from JSON files.
44
* Fixed joining negative prompts.
55
* Increased Control-LoRAs strength range.
6+
* Added links in Misc tab
67
* Updated Comfy.
78

89
### 1.0.45 MRE

webui.py

+12-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
from comfy.model_management import interrupt_current_processing
1919
from fastapi import FastAPI
2020
from modules.ui_gradio_extensions import reload_javascript
21+
from modules.util import get_current_log_path, get_previous_log_path
22+
2123

2224
GALLERY_ID_INPUT = 0
2325
GALLERY_ID_REVISION = 1
@@ -413,11 +415,19 @@ def model_refresh_clicked():
413415

414416
model_refresh.click(model_refresh_clicked, [], [base_model, refiner_model] + lora_ctrls)
415417

418+
416419
with gr.Tab(label='Misc'):
420+
def get_current_links():
421+
return '<a href="https://github.com/MoonRide303/Fooocus-MRE/wiki">&#128212; Fooocus-MRE Wiki</a>' \
422+
+ f' <a href="/file={get_current_log_path()}" target="_blank">&#128212; Current Log</a>' \
423+
+ f' <a href="/file={get_previous_log_path()}" target="_blank">&#128212; Previous Log</a>' \
424+
+ f' <a href="https://ko-fi.com/moonride" target="_blank">&#9749; Ko-fi</a>'
425+
417426
output_format = gr.Radio(label='Output Format', choices=['png', 'jpg'], value=settings['output_format'])
418427
with gr.Row():
419428
save_metadata_json = gr.Checkbox(label='Save Metadata in JSON', value=settings['save_metadata_json'])
420429
save_metadata_image = gr.Checkbox(label='Save Metadata in Image', value=settings['save_metadata_image'])
430+
links = gr.HTML(value=get_current_links())
421431
metadata_viewer = gr.JSON(label='Metadata')
422432

423433
advanced_checkbox.change(lambda x: gr.update(visible=x), advanced_checkbox, advanced_column)
@@ -448,7 +458,8 @@ def verify_input(img2img, canny, gallery_in, gallery_rev, gallery_out):
448458
.then(fn=verify_input, inputs=[img2img_mode, control_lora_canny, input_gallery, revision_gallery, output_gallery], outputs=[img2img_mode, control_lora_canny, input_gallery]) \
449459
.then(fn=verify_revision, inputs=[revision_mode, input_gallery, revision_gallery, output_gallery], outputs=[revision_mode, revision_gallery]) \
450460
.then(fn=generate_clicked, inputs=ctrls + [input_gallery, revision_gallery, keep_input_names],
451-
outputs=[generate_button, stop_button, progress_html, progress_window, gallery_holder, output_gallery, metadata_viewer, gallery_tabs])
461+
outputs=[generate_button, stop_button, progress_html, progress_window, gallery_holder, output_gallery, metadata_viewer, gallery_tabs]) \
462+
.then(fn=get_current_links, inputs=None, outputs=links)
452463

453464
def stop_clicked():
454465
interrupt_current_processing()

0 commit comments

Comments
 (0)