本文整理匯總了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)