File size: 733 Bytes
7b6bb0b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import gradio as gr
from gradio_rerun import Rerun


def predict(file_path: str | list[str]):
    return file_path


with gr.Blocks(css=".gradio-container { max-width: unset!important; }") as demo:
    with gr.Row():
        with gr.Column():
            file_path = gr.File(file_count="multiple", type="filepath")
        with gr.Column():
            pass
    btn = gr.Button("Run", scale=0)
    with gr.Row():
        rerun_viewer = Rerun(height=900)
    inputs = [file_path]
    outputs = [rerun_viewer]
    gr.on(
        [btn.click, file_path.upload],
        fn=predict,
        inputs=inputs,
        outputs=outputs,
    )
    gr.on([btn.click, file_path.upload], fn=predict, inputs=inputs, outputs=outputs)


demo.launch()