fix: name of method and formatting

This commit is contained in:
Artemy 2023-04-16 18:40:08 +03:00
parent 1b259c886f
commit fbc9112fba
9 changed files with 61 additions and 45 deletions

View file

@ -3,17 +3,22 @@ from processing.bulk import bulk_processing
with gr.Blocks() as app:
gr.Markdown(
"Mass processing of images one at a time and saving to video if needed. # **WIP, not working**")
"Mass processing of images one at a time and saving to video if needed. # **WIP, not working**"
)
with gr.Row():
with gr.Column():
directory = gr.Text(
placeholder="A directory with many images.", lines=1, label="Directory")
placeholder="A directory with many images.", lines=1, label="Directory"
)
method = gr.Dropdown(
choices=["canny edge", "sharpen"], value="canny edge", label="Method")
choices=["canny edge", "sharpen"], value="canny edge", label="Method"
)
with gr.Accordion("Advanced settings", open=False) as acc:
out_dir = gr.Text(
label="Output directory", placeholder="The directory where the processed photos will be saved. If not specified `./output/images`")
label="Output directory",
placeholder="The directory where the processed photos will be saved. If not specified `./output/images`",
)
submit = gr.Button("Submit")
submit.click(
fn=bulk_processing,

View file

@ -4,27 +4,42 @@ from processing.bulk import images_to_video
with gr.Blocks() as app:
gr.Markdown("Convert images to video.")
directory = gr.Text(
placeholder="A directory with many images of the same size", label="Directory")
placeholder="A directory with many images of the same size", label="Directory"
)
fps = gr.Number(label="FPS", value=30, min=0)
with gr.Accordion("Advanced settings", open=False) as acc:
video_name = gr.Text(
label="Video name", placeholder="Video name e.g. video. If not specified will be generated by time")
video_ext = gr.Dropdown(label="Video extension", choices=[
"mp4"], value="mp4")
label="Video name",
placeholder="Video name e.g. video. If not specified will be generated by time",
)
video_ext = gr.Dropdown(label="Video extension", choices=["mp4"], value="mp4")
video_dir = gr.Text(
label="Video directory", placeholder="The directory where the video will be saved. If not specified `./output/videos`")
label="Video directory",
placeholder="The directory where the video will be saved. If not specified `./output/videos`",
)
img_ext = gr.Dropdown(label="Image extension", choices=[
"png", "jpg"], value="png")
img_ext = gr.Dropdown(
label="Image extension", choices=["png", "jpg"], value="png"
)
img_name_format = gr.Text(
label="Image name format", placeholder="ffmpeg pattern e.g. %04d is (0000.png)", value="%d")
label="Image name format",
placeholder="ffmpeg pattern e.g. %04d is (0000.png)",
value="%d",
)
submit = gr.Button("Submit")
submit.click(
fn=images_to_video,
inputs=[directory, fps, img_ext, img_name_format,
video_name, video_ext, video_dir],
inputs=[
directory,
fps,
img_ext,
img_name_format,
video_name,
video_ext,
video_dir,
],
)

View file

@ -2,15 +2,14 @@ import gradio as gr
from processing.bulk import video_to_images
with gr.Blocks() as app:
gr.Markdown(
"Convert video to images.")
gr.Markdown("Convert video to images.")
with gr.Row():
with gr.Column():
video = gr.Video(label="Video")
with gr.Column():
format = gr.Radio(
choices=["png", "jpg"], value="png", label="Format of image")
choices=["png", "jpg"], value="png", label="Format of image"
)
submit = gr.Button("Submit")
submit.click(fn=video_to_images, inputs=[video, format])

View file

@ -1,6 +1 @@
tabs = [
"Stacking",
"Bulk processing",
"Images to video",
"Video to images"
]
tabs = ["Stacking", "Bulk processing", "Images to video", "Video to images"]