GitHub Action
Sync from GitHub
ef78361
Raw
History Blame Contribute Delete
2.3 kB
"""ํ† ํ”ฝ ์ธํ…”๋ฆฌ์ „์Šค 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)