File size: 1,187 Bytes
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
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:
    
    # ui
    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="Width", value="1024", type="text", interactive=True)
                new_height = gr.Textbox(label="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()