File size: 2,138 Bytes
e512f7f
74a2352
e512f7f
74a2352
e512f7f
74a2352
 
7cabef0
74a2352
 
7cabef0
74a2352
 
 
 
 
7cabef0
74a2352
 
 
 
 
e512f7f
74a2352
 
 
e512f7f
74a2352
 
 
 
e512f7f
74a2352
 
 
e512f7f
 
74a2352
 
 
e512f7f
 
74a2352
 
7cabef0
702f8f4
18e49ea
ed177cd
74a2352
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e512f7f
 
22d8c6e
74a2352
 
 
 
22d8c6e
e512f7f
74a2352
 
 
 
 
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
78
79
80
import gradio as gr
from utils import Pipeline

pip = Pipeline()

# -- Interface --
iface = gr.Blocks(css="css/style.css")

with iface:
    gr.Markdown("<center> <h2>🌳 Syntactic Tree Generator 🌳</h2> </center>")
    
    with gr.Row():
        with gr.Column():
            image = gr.Image(
                value="https://img.unocero.com/2019/11/facebook-app-para-hacer-memes-1-1024x576.jpg",show_label=False
            )
    
        with gr.Column():
            in_sentence = gr.Textbox(
                label="Input", 
                placeholder="Enter an expression here"
            )

            btn_get_tree = gr.Button(
                value="Generate Tree!"
            )

            out_str_tree = gr.Textbox(
                label="Flat tree",
                elem_id="no-outline"
            )

            error = gr.HTML(
                show_label=False
            )
    

    out_html_tree = gr.HTML(
        show_label=False
    )

    gr.Examples(
        inputs = in_sentence,
        examples = [ 
            "glass in guys hand on right first guy",
            "i have been happy",
            "the happy spiders",
            "the best dog out there",
            "girl 's face",
            'bottom grass',
            'rock people are sitting on',
            'blue sky center below clouds',
            'group of people on left',
            'tree middle',
            'the lump of grass above the bright rock in the bottom left',
            'berries in middle',
            'red shirt kid',
            'middle rock',
            'grass below the person in the straw hat',
            'grass on the left',
            'wall between stairs 2nd lv on right',
            'the large group of clouds',
            'sky top left',
            'rock structure on far right',
            'left donkey'],
        examples_per_page=10,
    )
    
    btn_get_tree.click(
        fn = pip.compute, 
        inputs = in_sentence, 
        outputs = [error, out_html_tree, out_str_tree],
        api_name= "gen_tree"
    )

iface.launch(
    server_name="0.0.0.0",
    # server_port=9090,
    # share = True
)