File size: 1,794 Bytes
b2d4cd1
b4ea00d
2a30c63
 
7de5033
06ef99c
 
 
 
 
 
 
 
 
97cff41
2a30c63
4599492
8cd18ad
 
2a30c63
547437b
 
444854a
 
 
9a62738
3ef0609
444854a
 
 
4af16fa
547437b
 
4af16fa
547437b
 
4af16fa
444854a
2d18a5e
 
021f887
b4ea00d
538f16e
444854a
f837291
b4ea00d
021f887
2a30c63
 
b2d4cd1
8cd18ad
e40ce1f
2a30c63
 
 
 
 
 
 
 
b2d4cd1
3e465ef
 
 
2d18a5e
538f16e
3e465ef
538f16e
2bd8e0e
282f66c
b4ea00d
547437b
 
 
4e7ea80
b2d4cd1
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
import gradio as gr
import time

css="""
#menu_btn{
    display: flex;
    background: blue;
    flex-direction: row;
    flex-wrap: nowrap;
    padding: 0;
    margin: 0;
    justify-content: center;
    align-items: center;
    min-width: 10px;
    border-radius: 3px;
}
#row_1{
    gap:0px;
}
"""

adj=[]

def up_html(inp):
    out = inp.replace("\n","<br>")
    print (out)
    return(gr.HTML.update(out),out)



def bold(inp):
    if "bold" in adj:
        adj.remove("bold")
        out = f"{inp}</b>"
    else:
        adj.append("bold")
        out = f"{inp}<b>"
    print (adj)
    out1,out2 = up_html(out)
    return out1,out2
    
def pause():
    time.sleep(0.1)

def txt_to_html(inp):
    return(inp)


with gr.Blocks(css=css) as app:
    with gr.Box():
        with gr.Row(elem_id='row_1'):
            btn1=gr.Button(value='🎃',elem_id='menu_btn')
            btn2=gr.Button(elem_id='menu_btn')
            btn3=gr.Button(elem_id='menu_btn')
            btn4=gr.Button(elem_id='menu_btn')
            btn5=gr.Button(elem_id='menu_btn')
            btn6=gr.Button(elem_id='menu_btn')
            btn7=gr.Button(elem_id='menu_btn')
            btn8=gr.Button(elem_id='menu_btn')
            btn9=gr.Button(elem_id='menu_btn')
        with gr.Row():
            inp=gr.Textbox(lines=6)
            outp=gr.Textbox(lines=6,every=0.1)
        out_html=gr.HTML()
    
    inp.change(pause,None,None,show_progress=False).then(txt_to_html,inp,outp,show_progress=False)
    #(up_html,outp,[out_html,outp], show_progress=False)
    outp.change(up_html,outp,[out_html,outp], show_progress=False)
    #out_html.change(up_html,outp,[out_html,outp], show_progress=False)

    btn1.click(bold,outp,[out_html,outp],show_progress=False)



app.queue(concurrency_count=100).launch()