feat: revert adding audio tab

This commit is contained in:
Manuel Schmid 2024-07-17 11:45:27 +02:00
parent 4f12bbb02b
commit aed3240ccd
No known key found for this signature in database
GPG Key ID: 32C4F7569B40B84B
1 changed files with 5 additions and 18 deletions

View File

@ -860,24 +860,6 @@ with shared.gradio_root:
refresh_files.click(refresh_files_clicked, [], refresh_files_output + lora_ctrls, refresh_files.click(refresh_files_clicked, [], refresh_files_output + lora_ctrls,
queue=False, show_progress=False) queue=False, show_progress=False)
with gr.Tab(label='Audio'):
play_notification = gr.Checkbox(label='Play notification after rendering', value=False)
notification_file = 'notification.mp3'
if os.path.exists(notification_file):
notification = gr.State(value=notification_file)
notification_input = gr.Audio(label='Notification', interactive=True, elem_id='audio_notification', visible=False, show_edit_button=False)
def play_notification_checked(r, notification):
return gr.update(visible=r, value=notification if r else None)
def notification_input_changed(notification_input, notification):
if notification_input:
notification = notification_input
return notification
play_notification.change(fn=play_notification_checked, inputs=[play_notification, notification], outputs=[notification_input], queue=False)
notification_input.change(fn=notification_input_changed, inputs=[notification_input, notification], outputs=[notification], queue=False)
state_is_generating = gr.State(False) state_is_generating = gr.State(False)
load_data_outputs = [advanced_checkbox, image_number, prompt, negative_prompt, style_selections, load_data_outputs = [advanced_checkbox, image_number, prompt, negative_prompt, style_selections,
@ -1045,6 +1027,11 @@ with shared.gradio_root:
progress_html, progress_window, progress_gallery, gallery], progress_html, progress_window, progress_gallery, gallery],
queue=False) queue=False)
for notification_file in ['notification.ogg', 'notification.mp3']:
if os.path.exists(notification_file):
gr.Audio(interactive=False, value=notification_file, elem_id='audio_notification', visible=False)
break
def trigger_describe(mode, img): def trigger_describe(mode, img):
if mode == flags.desc_type_photo: if mode == flags.desc_type_photo:
from extras.interrogate import default_interrogator as default_interrogator_photo from extras.interrogate import default_interrogator as default_interrogator_photo