File size: 2,345 Bytes
c59578d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
"""CV Parser dashboard β€” entry page.

Run from the project root:
    streamlit run dashboard/app.py
"""
import streamlit as st

import config
from lib.ui import model_selector

st.set_page_config(page_title="CV Parser Dashboard", page_icon="🧩", layout="wide")


def model_status_banner(lm):
    if lm.is_fallback:
        st.warning(
            f"**Demo mode β€” no fine-tuned model loaded.** Source: `{lm.source}`. "
            "The classification head is untrained, so entity predictions are "
            "**not meaningful** yet. Publish a model from the **Manage Model** page "
            f"to `{config.PRIMARY_MODEL_ID}`, or pick one in the sidebar.",
            icon="⚠️",
        )
    else:
        st.success(f"Model loaded β€” {lm.source}", icon="βœ…")


st.title("🧩 Automated CV Parser")
st.caption("WQF7007 NLP Β· Resume NER Β· extracts Job Titles, Skills & Education")

lm = model_selector()
model_status_banner(lm)

st.markdown(
    """
### What's inside

- **πŸ”Ž Live Parser** β€” paste or upload a single CV and watch it get **tokenized and
  classified** in real time: sub-word token chips coloured by predicted label, the
  original text with highlighted entities, and a clean structured summary.
- **πŸ“Š Analytics** β€” upload a batch of CVs (PDF / DOCX / TXT) and the page builds a
  **skills word cloud** plus top Job Titles / Skills / Education charts across the set.

Use the sidebar to switch pages.
"""
)

with st.expander("ℹ️ How the model is resolved"):
    st.markdown(
        f"""
        The sidebar **Model** picker selects which weights run. Options:

        1. **⭐ Best model (Hub)** β€” `{config.PRIMARY_MODEL_ID}`. The team's current
           best model; what the deployed app loads by default.
        2. **Custom HF model ID** β€” type any Hub repo id to load it live.
        3. **Local export** β€” `exported_models/…` folders (only on dev machines).
        4. **Demo fallback** β€” `{config.FALLBACK_MODEL}` with a random head
           (UI works, predictions don't).

        Teammates update the live model from the **πŸ” Manage Model** page (uploads
        an exported model and pushes it to the Hub repo) β€” no redeploy needed.
        After updating, click **πŸ”„ Reload model** in the sidebar.

        Label scheme: `{', '.join(config.LABELS)}`
        """
    )