image-pluser-webui/tabs/Bulk processing/app.py

28 lines
985 B
Python
Raw Normal View History

2023-04-16 08:51:33 +03:00
import gradio as gr
2023-04-16 10:36:29 +03:00
from processing.bulk import bulk_processing
2023-04-18 13:16:16 +03:00
from methods.bulk_methods import methods
2023-04-16 08:51:33 +03:00
with gr.Blocks() as app:
2023-04-21 14:25:22 +03:00
gr.Markdown("Mass processing of images one at a time.")
2023-04-16 08:51:33 +03:00
with gr.Row():
with gr.Column():
directory = gr.Text(
2023-04-16 18:40:08 +03:00
placeholder="A directory with many images.", lines=1, label="Directory"
)
2023-04-16 10:36:29 +03:00
method = gr.Dropdown(
2023-04-18 13:16:16 +03:00
choices=methods,
value=methods[0],
2023-04-17 20:20:27 +03:00
label="Method",
2023-04-16 18:40:08 +03:00
)
2023-04-16 10:36:29 +03:00
with gr.Accordion("Advanced settings", open=False) as acc:
out_dir = gr.Text(
2023-04-16 18:40:08 +03:00
label="Output directory",
placeholder="The directory where the processed photos will be saved. If not specified `./output/images`",
)
2023-04-16 08:51:33 +03:00
submit = gr.Button("Submit")
2023-04-16 10:36:29 +03:00
submit.click(
fn=bulk_processing,
inputs=[directory, out_dir, method],
)