congdc's picture
refactor: change name image size
2f1359d
import gradio as gr
from core.base import repeat_partent
with gr.Blocks(theme=gr.themes.Soft(primary_hue=gr.themes.colors.blue)) as demo:
gr.Markdown("""
# Repeating Pattern
This app takes an image and repeats the pattern in the image to fill the target tile size.
""")
with gr.Row():
with gr.Column():
image_input = gr.Image(label="Input Image", interactive=True, sources="upload", type="pil")
with gr.Row():
new_width = gr.Textbox(label="New width", value="1024", type="text", interactive=True)
new_height = gr.Textbox(label="New height", value="1024", type="text", interactive=True)
image_output = gr.Image(label="Ouptut", interactive=False, show_download_button = True)
process_btn = gr.Button(value="process", variant="primary")
process_btn.click(
fn=repeat_partent,
inputs=[image_input, new_width, new_height],
outputs=[image_output],
show_api=False
)
gr.Examples(
fn=repeat_partent,
examples=[
["assets/input_01.png", "3072", "3072"],
["assets/input_02.webp", "4096", "2048"],
],
inputs=[image_input, new_width, new_height],
outputs=[image_output],
cache_examples = True)
demo.queue().launch()