|
1 | 1 | import gradio as gr
|
2 |
| -from modules import shared, sd_samplers, ui_toprow, ui, ui_settings, errors |
| 2 | +from modules import shared, sd_samplers, ui, ui_settings, errors |
| 3 | +try: |
| 4 | + from modules import ui_toprow |
| 5 | +except: |
| 6 | + ui_toprow = None |
3 | 7 | from modules.ui_components import ToolButton, ResizeHandleRow
|
4 | 8 | from modules.call_queue import wrap_gradio_gpu_call, wrap_queued_call
|
5 | 9 | from modules.ui_common import create_output_panel, refresh_symbol, update_generation_info
|
@@ -50,6 +54,8 @@ def unloadModels():
|
50 | 54 |
|
51 | 55 |
|
52 | 56 | def getSubmitJsFunction(galleryId, buttonsId, extraShowButtonsId):
|
| 57 | + if not ui_toprow: |
| 58 | + return '' |
53 | 59 | return 'function(){'\
|
54 | 60 | 'var arguments_ = Array.from(arguments);'\
|
55 | 61 | f'arguments_.push("{extraShowButtonsId}", "{buttonsId}", "{galleryId}");'\
|
@@ -134,11 +140,14 @@ def getReplacerTabUI(isDedicatedPage):
|
134 | 140 | )
|
135 | 141 |
|
136 | 142 | runButtonIdPart='replacer'
|
137 |
| - toprow = ui_toprow.Toprow(is_compact=True, is_img2img=False, id_part=runButtonIdPart) |
138 |
| - toprow.create_inline_toprow_image() |
139 |
| - run_button = toprow.submit |
140 |
| - run_button.variant = 'secondary' |
141 |
| - run_button.value = 'Run' |
| 143 | + if ui_toprow: |
| 144 | + toprow = ui_toprow.Toprow(is_compact=True, is_img2img=False, id_part=runButtonIdPart) |
| 145 | + toprow.create_inline_toprow_image() |
| 146 | + run_button = toprow.submit |
| 147 | + run_button.variant = 'secondary' |
| 148 | + run_button.value = 'Run' |
| 149 | + else: |
| 150 | + run_button = gr.Button("Run") |
142 | 151 |
|
143 | 152 |
|
144 | 153 | with gr.Accordion("Advanced options", open=False, elem_id='replacer_advanced_options'):
|
@@ -475,11 +484,14 @@ def getReplacerTabUI(isDedicatedPage):
|
475 | 484 | )
|
476 | 485 |
|
477 | 486 | with gr.Row():
|
478 |
| - toprow = ui_toprow.Toprow(is_compact=True, is_img2img=False, id_part=f'{runButtonIdPart}_hf') |
479 |
| - toprow.create_inline_toprow_image() |
480 |
| - apply_hires_fix_button = toprow.submit |
481 |
| - apply_hires_fix_button.variant = 'secondary' |
482 |
| - apply_hires_fix_button.value = 'Apply HiresFix' |
| 487 | + if ui_toprow: |
| 488 | + toprow = ui_toprow.Toprow(is_compact=True, is_img2img=False, id_part=f'{runButtonIdPart}_hf') |
| 489 | + toprow.create_inline_toprow_image() |
| 490 | + apply_hires_fix_button = toprow.submit |
| 491 | + apply_hires_fix_button.variant = 'secondary' |
| 492 | + apply_hires_fix_button.value = 'Apply HiresFix' |
| 493 | + else: |
| 494 | + apply_hires_fix_button = gr.Button('Apply HiresFix') |
483 | 495 |
|
484 | 496 | with gr.Row():
|
485 | 497 | with gr.Accordion("HiresFix options", open=False):
|
@@ -733,7 +745,7 @@ def tab_batch_video_on_select():
|
733 | 745 | html_info,
|
734 | 746 | html_log,
|
735 | 747 | ],
|
736 |
| - show_progress=False, |
| 748 | + show_progress=ui_toprow is None, |
737 | 749 | )
|
738 | 750 |
|
739 | 751 |
|
@@ -766,7 +778,7 @@ def tab_batch_video_on_select():
|
766 | 778 | html_info,
|
767 | 779 | html_log,
|
768 | 780 | ],
|
769 |
| - show_progress=False, |
| 781 | + show_progress=ui_toprow is None, |
770 | 782 | )
|
771 | 783 |
|
772 | 784 |
|
|
0 commit comments