File size: 2,309 Bytes
585684d
cc6e340
585684d
5226e0b
 
 
 
 
 
 
 
 
6a6244a
 
 
5226e0b
 
 
 
 
cc6e340
5226e0b
585684d
 
 
5226e0b
cc6e340
 
 
 
 
 
 
 
5226e0b
 
 
 
 
cc6e340
5226e0b
49baf11
6a6244a
cc6e340
5226e0b
 
 
4f64249
 
 
 
5226e0b
6a6244a
4f64249
cc6e340
4f64249
5226e0b
6a6244a
 
 
4f64249
5226e0b
 
 
 
 
 
 
 
cc6e340
5226e0b
 
 
 
 
585684d
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import gradio as gr
from functions import *

# ---------------------------- #
# global variables
# ---------------------------- #
custom_css = """
#mytextbox textarea {
    color: blue;
    background-color: #f0f0f0;
    font-weight: bold;
}
#title {
    text-align: center;
}
"""



# ---------------------------- #
# GRADIO functions
# ---------------------------- #
def greet(name):
    return "Hello " + name + "!!"


def process_file(file_dir):
    print('INSIDE process_file')
    map_np, (height, width) = get_np_from_dot_map(file_dir)
    print(f'{height=}, {width=}')
    print(map_np)
    return


# ---------------------------- #
# main blocks
# ---------------------------- #
with gr.Blocks(css=custom_css) as demo:
    # ARRANGEMENTS
    gr.Markdown("# LLM Assistant for MAPF", elem_id="title")
    with gr.Row():
        with gr.Column(scale=10):
            gr.Markdown("## Input Data")
            input_map = gr.File(label="Drop a `.map` file")
            input_start_locations = gr.Textbox(label='Start locations config:')
            input_goal_locations = gr.Textbox(label='Goal locations config:')
            solve_btn = gr.Button("Solve", variant='primary')
            gr.Markdown("Example inputs:")
            ex1_btn = gr.Button("Example 1")
            ex2_btn = gr.Button("Example 2")
            ex3_btn = gr.Button("Example 3")
        with gr.Column(scale=12):
            gr.Markdown("## Output Result")
            output_alg = gr.Textbox(label='Chosen algorithm:', interactive=False)
            output_expl = gr.Textbox(label='Explanation:', interactive=False)
            output_sol = gr.Textbox(label='Solution:', interactive=False)
            with gr.Row():
                output_soc = gr.Number(label='Sum-of-Costs:', interactive=False)
                output_makespan = gr.Number(label='Makespan:', interactive=False)
                output_rt = gr.Number(label='Runtime:', interactive=False)
            output_env = gr.Video(label="Solution illustration:", autoplay=True, interactive=False)
    with gr.Accordion("TODO List", open=False):
        gr.Markdown("""
        ## PLAN
        - [ ] todo
        """)


    # EVENTS
    input_map.upload(process_file, input_map)


# ---------------------------- #
# launch
# ---------------------------- #
demo.launch()