mirror of
https://github.com/lllyasviel/Fooocus.git
synced 2026-08-16 13:13:16 +02:00
fix gradio again (#418)
This commit is contained in:
@@ -79,31 +79,8 @@ with shared.gradio_root:
|
|||||||
_js="(x) => {if(x){setTimeout(() => window.scrollTo({ top: window.scrollY + 500, behavior: 'smooth' }), 50);}else{setTimeout(() => window.scrollTo({ top: 0, behavior: 'smooth' }), 50);} return x}")
|
_js="(x) => {if(x){setTimeout(() => window.scrollTo({ top: window.scrollY + 500, behavior: 'smooth' }), 50);}else{setTimeout(() => window.scrollTo({ top: 0, behavior: 'smooth' }), 50);} return x}")
|
||||||
|
|
||||||
current_tab = gr.Textbox(value='uov', visible=False)
|
current_tab = gr.Textbox(value='uov', visible=False)
|
||||||
|
uov_tab.select(lambda: 'uov', outputs=current_tab, queue=False)
|
||||||
def get_image_cacher(flag):
|
inpaint_tab.select(lambda: 'inpaint', outputs=current_tab, queue=False)
|
||||||
def inner_func(previous_flag, *prs):
|
|
||||||
global last_image
|
|
||||||
|
|
||||||
index = {
|
|
||||||
'uov': 0,
|
|
||||||
'inpaint': 1
|
|
||||||
}[previous_flag]
|
|
||||||
|
|
||||||
x = prs[index]
|
|
||||||
|
|
||||||
if isinstance(x, dict):
|
|
||||||
last_image = x['image']
|
|
||||||
else:
|
|
||||||
last_image = x
|
|
||||||
|
|
||||||
return flag, last_image
|
|
||||||
|
|
||||||
return inner_func
|
|
||||||
|
|
||||||
tab_img_swap_ctrls = [current_tab, uov_input_image, inpaint_input_image]
|
|
||||||
|
|
||||||
uov_tab.select(get_image_cacher('uov'), inputs=tab_img_swap_ctrls, outputs=[current_tab, uov_input_image], queue=False)
|
|
||||||
inpaint_tab.select(get_image_cacher('inpaint'), inputs=tab_img_swap_ctrls, outputs=[current_tab, inpaint_input_image], queue=False)
|
|
||||||
|
|
||||||
with gr.Column(scale=0.5, visible=False) as right_col:
|
with gr.Column(scale=0.5, visible=False) as right_col:
|
||||||
with gr.Tab(label='Setting'):
|
with gr.Tab(label='Setting'):
|
||||||
|
|||||||
Reference in New Issue
Block a user