Some Fixes for Gradio 3.36.1 (#1637)

* Clear .style deprecation warnings.
* Re-remove download button from Nod logos.
* Add work around for `container=false` not doing what it did before on
dropdowns to the output gallery CSS
This commit is contained in:
Stefan Kapusniak
2023-07-08 19:20:34 +01:00
committed by GitHub
parent af0f715e20
commit 1c2ec3c7a2
10 changed files with 88 additions and 33 deletions

View File

@@ -227,10 +227,19 @@ footer {
}
/* Hide the download icon from the nod logo */
#top_logo .download {
#top_logo button {
display: none;
}
/* workarounds for container=false not currently working for dropdowns */
.dropdown_no_container {
padding: 0 !important;
}
#output_subdir_container :first-child {
border: none;
}
/* reduced animation load when generating */
.generating {
animation-play-state: paused !important;

View File

@@ -366,7 +366,9 @@ with gr.Blocks(title="Image-to-Image") as img2img_web:
show_label=False,
interactive=False,
elem_id="top_logo",
).style(width=150, height=50)
width=150,
height=50,
)
with gr.Row(elem_id="ui_body"):
with gr.Row():
with gr.Column(scale=1, min_width=600):
@@ -432,7 +434,8 @@ with gr.Blocks(title="Image-to-Image") as img2img_web:
source="upload",
tool="sketch",
type="pil",
).style(height=300)
height=300,
)
with gr.Accordion(label="Stencil Options", open=False):
with gr.Row():
@@ -633,7 +636,9 @@ with gr.Blocks(title="Image-to-Image") as img2img_web:
label="Generated images",
show_label=False,
elem_id="gallery",
).style(columns=[2], object_fit="contain")
columns=2,
object_fit="contain",
)
std_output = gr.Textbox(
value=f"Images will be saved at "
f"{get_generated_imgs_path()}",

View File

@@ -314,7 +314,9 @@ with gr.Blocks(title="Inpainting") as inpaint_web:
show_label=False,
interactive=False,
elem_id="top_logo",
).style(width=150, height=50)
width=150,
height=50,
)
with gr.Row(elem_id="ui_body"):
with gr.Row():
with gr.Column(scale=1, min_width=600):
@@ -384,7 +386,8 @@ with gr.Blocks(title="Inpainting") as inpaint_web:
source="upload",
tool="sketch",
type="pil",
).style(height=350)
height=350,
)
with gr.Accordion(label="LoRA Options", open=False):
with gr.Row():
@@ -533,7 +536,9 @@ with gr.Blocks(title="Inpainting") as inpaint_web:
label="Generated images",
show_label=False,
elem_id="gallery",
).style(columns=[2], object_fit="contain")
columns=[2],
object_fit="contain",
)
std_output = gr.Textbox(
value=f"Images will be saved at "
f"{get_generated_imgs_path()}",

View File

@@ -24,7 +24,9 @@ with gr.Blocks(title="Lora Training") as lora_train_web:
show_label=False,
interactive=False,
elem_id="top_logo",
).style(width=150, height=50)
width=150,
height=50,
)
with gr.Row(elem_id="ui_body"):
with gr.Row():
with gr.Column(scale=1, min_width=600):

View File

@@ -322,7 +322,9 @@ with gr.Blocks(title="Outpainting") as outpaint_web:
show_label=False,
interactive=False,
elem_id="top_logo",
).style(width=150, height=50)
width=150,
height=50,
)
with gr.Row(elem_id="ui_body"):
with gr.Row():
with gr.Column(scale=1, min_width=600):
@@ -388,8 +390,10 @@ with gr.Blocks(title="Outpainting") as outpaint_web:
)
outpaint_init_image = gr.Image(
label="Input Image", type="pil"
).style(height=300)
label="Input Image",
type="pil",
height=300,
)
with gr.Accordion(label="LoRA Options", open=False):
with gr.Row():
@@ -560,7 +564,9 @@ with gr.Blocks(title="Outpainting") as outpaint_web:
label="Generated images",
show_label=False,
elem_id="gallery",
).style(columns=[2], object_fit="contain")
columns=[2],
object_fit="contain",
)
std_output = gr.Textbox(
value=f"Images will be saved at "
f"{get_generated_imgs_path()}",

View File

@@ -89,33 +89,43 @@ with gr.Blocks() as outputgallery_web:
value=gallery_files.value,
visible=False,
show_label=True,
).style(columns=4)
columns=2,
)
with gr.Column(scale=4):
with gr.Box():
with gr.Row():
with gr.Column(scale=16, min_width=160):
with gr.Column(
scale=16,
min_width=160,
elem_id="output_subdir_container",
):
subdirectories = gr.Dropdown(
label=f"Subdirectories of {output_dir}",
type="value",
choices=subdirectory_paths.value,
value="",
interactive=True,
).style(container=False)
elem_classes="dropdown_no_container",
)
with gr.Column(
scale=1, min_width=32, elem_id="output_refresh_button"
):
refresh = gr.Button(
variant="secondary",
value="\u21BB", # unicode clockwise arrow circle
).style(size="sm")
size="sm",
)
image_columns = gr.Slider(
label="Columns shown", value=4, minimum=1, maximum=16, step=1
)
outputgallery_filename = gr.Textbox(
label="Filename", value="None", interactive=False
).style(show_copy_button=True)
label="Filename",
value="None",
interactive=False,
show_copy_button=True,
)
with gr.Accordion(
label="Parameter Information", open=False
@@ -134,31 +144,36 @@ with gr.Blocks() as outputgallery_web:
value="Txt2Img",
interactive=False,
elem_classes="outputgallery_sendto",
).style(size="sm")
size="sm",
)
outputgallery_sendto_img2img = gr.Button(
value="Img2Img",
interactive=False,
elem_classes="outputgallery_sendto",
).style(size="sm")
size="sm",
)
outputgallery_sendto_inpaint = gr.Button(
value="Inpaint",
interactive=False,
elem_classes="outputgallery_sendto",
).style(size="sm")
size="sm",
)
outputgallery_sendto_outpaint = gr.Button(
value="Outpaint",
interactive=False,
elem_classes="outputgallery_sendto",
).style(size="sm")
size="sm",
)
outputgallery_sendto_upscaler = gr.Button(
value="Upscaler",
interactive=False,
elem_classes="outputgallery_sendto",
).style(size="sm")
size="sm",
)
# --- Event handlers

View File

@@ -155,7 +155,7 @@ with gr.Blocks(title="Chatbot") as stablelm_chat:
],
visible=True,
)
chatbot = gr.Chatbot().style(height=500)
chatbot = gr.Chatbot(height=500)
with gr.Row():
with gr.Column():
msg = gr.Textbox(
@@ -163,7 +163,8 @@ with gr.Blocks(title="Chatbot") as stablelm_chat:
placeholder="Chat Message Box",
show_label=False,
interactive=enabled,
).style(container=False)
container=False,
)
with gr.Column():
with gr.Row():
submit = gr.Button("Submit", interactive=enabled)

View File

@@ -289,7 +289,9 @@ with gr.Blocks(title="Text-to-Image") as txt2img_web:
show_label=False,
interactive=False,
elem_id="top_logo",
).style(width=150, height=50)
width=150,
height=50,
)
with gr.Row(elem_id="ui_body"):
with gr.Row():
with gr.Column(scale=1, min_width=600):
@@ -508,7 +510,9 @@ with gr.Blocks(title="Text-to-Image") as txt2img_web:
label="Generated images",
show_label=False,
elem_id="gallery",
).style(columns=[2], object_fit="contain")
columns=[2],
object_fit="contain",
)
std_output = gr.Textbox(
value=f"Images will be saved at "
f"{get_generated_imgs_path()}",

View File

@@ -335,7 +335,9 @@ with gr.Blocks(title="Upscaler") as upscaler_web:
show_label=False,
interactive=False,
elem_id="top_logo",
).style(width=150, height=50)
width=150,
height=50,
)
with gr.Row(elem_id="ui_body"):
with gr.Row():
with gr.Column(scale=1, min_width=600):
@@ -401,8 +403,10 @@ with gr.Blocks(title="Upscaler") as upscaler_web:
)
upscaler_init_image = gr.Image(
label="Input Image", type="pil"
).style(height=300)
label="Input Image",
type="pil",
height=300,
)
with gr.Accordion(label="LoRA Options", open=False):
with gr.Row():
@@ -552,7 +556,9 @@ with gr.Blocks(title="Upscaler") as upscaler_web:
label="Generated images",
show_label=False,
elem_id="gallery",
).style(columns=[2], object_fit="contain")
columns=[2],
object_fit="contain",
)
std_output = gr.Textbox(
value=f"Images will be saved at "
f"{get_generated_imgs_path()}",

View File

@@ -24,7 +24,9 @@ with gr.Blocks(title="Dataset Annotation Tool", css=demo_css) as shark_web:
show_label=False,
interactive=False,
elem_id="top_logo",
).style(width=150, height=100)
width=150,
height=100,
)
datasets, images, ds_w_prompts = get_datasets(args.gs_url)
prompt_data = dict()
@@ -37,7 +39,7 @@ with gr.Blocks(title="Dataset Annotation Tool", css=demo_css) as shark_web:
with gr.Row(elem_id="ui_body"):
# TODO: add ability to search image by typing
with gr.Column(scale=1, min_width=600):
image = gr.Image(type="filepath").style(height=512)
image = gr.Image(type="filepath", height=512)
with gr.Column(scale=1, min_width=600):
prompts = gr.Dropdown(