File size: 3,385 Bytes
031caeb
5dd070e
c541f79
 
5dd070e
8ebb3ac
5dd070e
 
8ebb3ac
5dd070e
da9e7af
8ebb3ac
5dd070e
 
c541f79
5dd070e
8ebb3ac
 
 
 
 
c541f79
5dd070e
 
 
c541f79
8ebb3ac
 
 
5dd070e
c541f79
8ebb3ac
 
c541f79
8ebb3ac
c541f79
8ebb3ac
c541f79
8ebb3ac
5dd070e
8ebb3ac
 
 
5dd070e
8ebb3ac
 
 
 
 
 
 
 
 
5dd070e
8ebb3ac
 
 
 
 
 
 
 
 
 
 
 
 
5dd070e
8ebb3ac
 
 
 
 
5dd070e
8ebb3ac
 
 
 
 
5dd070e
8ebb3ac
5dd070e
 
 
 
c541f79
 
8ebb3ac
5dd070e
c541f79
 
8ebb3ac
5dd070e
c541f79
 
 
8ebb3ac
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98

import streamlit as st

from utils import set_page_config

# Set the Streamlit page configuration
set_page_config()

# Display main app title
st.title("CodeGen Hub")

# App description with markdown formatting
st.markdown("""
    Welcome to CodeGen Hub - A platform for training and using code generation models with Hugging Face integration.

    ### Core Features:
    - ๐Ÿ“‚ Upload and preprocess Python code datasets for model training
    - ๐ŸŽ›๏ธ Configure and train models with customizable parameters
    - ๐Ÿค– Generate code predictions using trained models through an interactive interface
    - ๐Ÿ“Š Monitor training progress with visualizations and detailed logs
    - ๐Ÿ”— Seamless integration with Hugging Face Hub for model management

    Navigate through the different sections using the sidebar menu.
""")


# Sidebar navigation using session state
def navigate(page):
    st.session_state["current_page"] = page


# Initialize session state variables using a loop
session_defaults = {
    "datasets": {},  # Stores uploaded datasets
    "trained_models": {},  # Stores trained model details
    "training_logs": [],  # Stores training logs
    "training_progress": {},  # Tracks active training jobs
    "current_page": "home",  # Default landing page
}

for key, value in session_defaults.items():
    if key not in st.session_state:
        st.session_state[key] = value

# Display sidebar with navigation buttons
with st.sidebar:
    st.header("Navigation")
    if st.button("๐Ÿ—๏ธ Dataset Management"):
        navigate("dataset_management")
    if st.button("๐ŸŽฏ Model Training"):
        navigate("model_training")
    if st.button("๐Ÿ”ฎ Code Generation"):
        navigate("code_generation")

# Render content dynamically based on session state
if st.session_state["current_page"] == "dataset_management":
    st.subheader("Dataset Management")
    st.write("Upload and manage your datasets here.")
elif st.session_state["current_page"] == "model_training":
    st.subheader("Model Training")
    st.write("Configure and train your models.")
elif st.session_state["current_page"] == "code_generation":
    st.subheader("Code Generation")
    st.write("Generate predictions using your trained models.")
else:
    st.subheader("Getting Started")
    col1, col2 = st.columns(2)

    with col1:
        st.info("""
            1. ๐Ÿ“Š Start by uploading or selecting a Python code dataset in the **Dataset Management** section.
            2. ๐Ÿ› ๏ธ Configure and train your model in the **Model Training** section.
        """)

    with col2:
        st.info("""
            3. ๐Ÿ’ก Generate code predictions using your trained models in the **Code Generation** section.
            4. ๐Ÿ”„ Access your models on Hugging Face Hub for broader use.
        """)

# Display platform statistics dynamically
st.subheader("Platform Statistics")
col1, col2, col3 = st.columns(3)

with col1:
    st.metric("๐Ÿ“‚ Datasets Available", len(st.session_state.get("datasets",
                                                               {})))

with col2:
    st.metric("๐Ÿ“ฆ Trained Models",
              len(st.session_state.get("trained_models", {})))

with col3:
    active_jobs = sum(
        1 for progress in st.session_state["training_progress"].values()
        if progress.get("status") == "running")
    st.metric("๐Ÿš€ Active Training Jobs", active_jobs)