Merge pull request #606 from DrakeRichards/notification-sounds

Adding notification.mp3 support
This commit is contained in:
Vladimir Mandic
2023-05-02 15:12:13 -04:00
committed by GitHub
4 changed files with 6 additions and 0 deletions
+1
View File
@@ -27,6 +27,7 @@ venv
/*.bat
/*.sh
/*.txt
/notification.mp3
!webui.bat
!webui.sh
Binary file not shown.
+2
View File
@@ -412,6 +412,8 @@ options_templates.update(options_section(('ui', "Live previews"), {
"show_progressbar": OptionInfo(True, "Show progressbar"),
"live_previews_enable": OptionInfo(True, "Show live previews of the created image"),
"show_progress_grid": OptionInfo(True, "Show previews of all images generated in a batch as a grid"),
"notification_audio_enable": OptionInfo(False, "Play a sound when images are finished generating."),
"notification_audio_path": OptionInfo("html/notification_default.mp3","Path to notification sound",component_args=hide_dirs),
"show_progress_every_n_steps": OptionInfo(1, "Show new live preview image every N sampling steps. Set to -1 to show after completion of batch.", gr.Slider, {"minimum": -1, "maximum": 32, "step": 1}),
"show_progress_type": OptionInfo("Approx NN", "Image creation progress preview mode", gr.Radio, {"choices": ["Full", "Approx NN", "Approx cheap"]}),
"live_preview_content": OptionInfo("Combined", "Live preview subject", gr.Radio, {"choices": ["Combined", "Prompt", "Negative prompt"]}),
+3
View File
@@ -1384,6 +1384,9 @@ def create_ui():
with gr.TabItem(label, id=ifid, elem_id='tab_' + ifid):
interface.render()
if opts.notification_audio_enable and os.path.exists(os.path.join(script_path, opts.notification_audio_path)):
audio_notification = gr.Audio(interactive=False, value=os.path.join(script_path, opts.notification_audio_path), elem_id="audio_notification", visible=False)
text_settings = gr.Textbox(elem_id="settings_json", value=lambda: opts.dumpjson(), visible=False)
settings_submit.click(
fn=wrap_gradio_call(run_settings, extra_outputs=[gr.update()]),