Spaces:
Runtime error
Runtime error
File size: 1,351 Bytes
ca63cf1 93862c1 ca63cf1 2f1359d ca63cf1 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
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() |