File size: 963 Bytes
937eac0
a6ea9eb
f89ffaf
 
 
 
937eac0
61f3e50
faaa17d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ab0de04
937eac0
472ba1f
7513cd5
1304c9b
ab0de04
1304c9b
a6ea9eb
a2d7220
937eac0
 
ab0de04
937eac0
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
import gradio as gr
import pandas as pd
from loguru import logger

logger.debug("debug {}", gr.__version__)
logger.info("info {}", gr.__version__)

def fn(input=""):
    df = pd.DataFrame(data={'x': [1, 2], 'y': [3, 4], "cos": [0.1111, 0.51111]})
    styled = df.style.set_properties(
        **{
            "font-size": "10pt",
            "border-color": "black",
            "border": "1px black solid !important"
        }
    # border-color="black",
    ).set_table_styles([{
        "selector": "",  # noqs
        "props": [("border", "2px black solid !important")]}]  # noqs
    ).format(
        precision=2
    )
    return df, styled.to_html()
    
iface = gr.Interface(
    fn,
    "text",
    ["dataframe", gr.outputs.HTML()],
    title="Test dataframe and html",
    # description="Test dataframe and html",
    examples=["a", "b"],
    # layout="vertical",  # unaligned horizontal vertical
)

iface.launch(share=False, debug=True)
# iface.launch()