fancy-power / app.py
mikeee's picture
Update app.py
a2d7220
raw
history blame contribute delete
963 Bytes
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()