本文整理汇总了Python中streamlit.title方法的典型用法代码示例。如果您正苦于以下问题:Python streamlit.title方法的具体用法?Python streamlit.title怎么用?Python streamlit.title使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类streamlit
的用法示例。
在下文中一共展示了streamlit.title方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: show_label_distribution
# 需要导入模块: import streamlit [as 别名]
# 或者: from streamlit import title [as 别名]
def show_label_distribution(
sample_labels: Union[List[str], List[List[str]]],
all_labels: Optional[Union[List[str], List[List[str]]]] = None,
):
if sample_labels is not None:
st.header("Label Distribution")
label_counts = _collect_label_counts(sample_labels)
if all_labels is None:
label_chart = (
alt.Chart(label_counts, height=500, width=700)
.mark_bar()
.encode(
alt.X("Label", type="nominal"),
alt.Y("Proportion", type="quantitative"),
)
)
else:
label_counts["Label Set"] = "Sample"
all_label_counts = _collect_label_counts(all_labels)
all_label_counts["Label Set"] = "All Documents"
label_counts = pd.concat([label_counts, all_label_counts])
label_chart = (
alt.Chart(label_counts, width=100)
.mark_bar()
.encode(
alt.X(
"Label Set",
type="nominal",
title=None,
sort=["Sample", "All Documents"],
),
alt.Y("Proportion", type="quantitative"),
alt.Column(
"Label", type="nominal", header=alt.Header(labelAngle=0)
),
alt.Color("Label Set", type="nominal", legend=None),
)
)
st.altair_chart(label_chart)