Spaces:
Sleeping
Sleeping
File size: 2,302 Bytes
ef78361 | 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 | """ํ ํฝ ์ธํ
๋ฆฌ์ ์ค Feature ์์ฝ ์นด๋."""
import streamlit as st
def render_summary(clusters: list, frame: str = "all"):
"""ํ ํฝ ์ธํ
๋ฆฌ์ ์ค ์์ฝ ๋ฉํธ๋ฆญ.
Args:
clusters: List of cluster dicts.
frame: "demand" (ChatGPT), "supply" (Gemini), or "all".
"""
scored = [c for c in clusters if c.get("opportunity_score") is not None]
# Frame-specific labels
if frame == "demand":
count_label = "Demand ํ ํฝ"
volume_label = "์ด Fanout"
volume_help = "ChatGPT๊ฐ ์ฌ์ฉ์ ์ง๋ฌธ์ ๋ถํดํ ์ธ๋ถ ์ง๋ฌธ์ ์ด ์"
attn_help = "๊ฐ ํ ํฝ์ด ์ ์ฒด ChatGPT ์ง์์์ ์ฐจ์งํ๋ ๋น์ค์ ํ๊ท "
top_help = "ChatGPT์์ ๊ด์ฌ๋๋ ๋์ง๋ง ๊ฒฝ์์ด ๋ฎ์ ์ฝํ
์ธ ๊ธฐํ๊ฐ ๊ฐ์ฅ ํฐ ํ ํฝ"
elif frame == "supply":
count_label = "Supply ํ ํฝ"
volume_label = "์ด Citation"
volume_help = "Gemini๊ฐ ๋ต๋ณ์์ ์ธ์ฉํ ๋ฌธ๊ตฌ์ ์ด ์"
attn_help = "๊ฐ ํ ํฝ์ด ์ ์ฒด Gemini ์ธ์ฉ์์ ์ฐจ์งํ๋ ๋น์ค์ ํ๊ท "
top_help = "Gemini์์ ์ธ์ฉ ๋น๋๋ ๋์ง๋ง ๊ฒฝ์์ด ๋ฎ์ ์ฝํ
์ธ ๊ธฐํ๊ฐ ๊ฐ์ฅ ํฐ ํ ํฝ"
else:
count_label = "์ด ํด๋ฌ์คํฐ"
volume_label = "์ด Fanout"
volume_help = "AI๊ฐ ์ฌ์ฉ์ ์ง๋ฌธ์ ์กฐ์ฌํ๊ธฐ ์ํด ์์ฑํ ์ธ๋ถ ์ง๋ฌธ์ ์ด ์"
attn_help = "๊ฐ ํ ํฝ์ด ์ ์ฒด ์ง์์์ ์ฐจ์งํ๋ ๋น์ค์ ํ๊ท "
top_help = "AI ๊ด์ฌ๋๋ ๋์ง๋ง ๊ฒฝ์์ด ๋ฎ์ ์ฝํ
์ธ ๊ธฐํ๊ฐ ๊ฐ์ฅ ํฐ ํ ํฝ"
col1, col2, col3, col4 = st.columns(4)
with col1:
st.metric(
count_label, len(clusters),
help="์ ์ฌํ AI ์ง๋ฌธ/์ธ์ฉ๋ค์ ๋ฌถ์ ํ ํฝ ๊ทธ๋ฃน ์",
)
with col2:
total_fanouts = sum(c.get("fanout_count", 0) for c in clusters)
st.metric(volume_label, f"{total_fanouts:,}", help=volume_help)
with col3:
avg_attn = sum(float(c.get("attention_score", 0) or 0) for c in scored) / len(scored) if scored else 0
st.metric("ํ๊ท Attention", f"{avg_attn:.4f}", help=attn_help)
with col4:
top_label = scored[0].get("cluster_label", "N/A") if scored else "N/A"
st.metric("Top Opportunity", top_label[:20], help=top_help)
|