Spaces:
Runtime error
Runtime error
Upload 14 files
Browse files
app.py
CHANGED
@@ -1,97 +1,71 @@
|
|
1 |
-
|
2 |
import streamlit as st
|
|
|
|
|
3 |
|
4 |
-
|
5 |
-
|
6 |
-
# Set the Streamlit page configuration
|
7 |
set_page_config()
|
8 |
|
9 |
-
#
|
10 |
st.title("CodeGen Hub")
|
11 |
-
|
12 |
-
# App description with markdown formatting
|
13 |
st.markdown("""
|
14 |
Welcome to CodeGen Hub - A platform for training and using code generation models with Hugging Face integration.
|
15 |
-
|
16 |
### Core Features:
|
17 |
-
-
|
18 |
-
-
|
19 |
-
-
|
20 |
-
-
|
21 |
-
-
|
22 |
-
|
23 |
Navigate through the different sections using the sidebar menu.
|
24 |
""")
|
25 |
|
|
|
|
|
26 |
|
27 |
-
#
|
28 |
-
|
29 |
-
st.session_state
|
30 |
|
|
|
|
|
31 |
|
32 |
-
|
33 |
-
|
34 |
-
"datasets": {}, # Stores uploaded datasets
|
35 |
-
"trained_models": {}, # Stores trained model details
|
36 |
-
"training_logs": [], # Stores training logs
|
37 |
-
"training_progress": {}, # Tracks active training jobs
|
38 |
-
"current_page": "home", # Default landing page
|
39 |
-
}
|
40 |
|
41 |
-
|
42 |
-
|
43 |
-
st.session_state[key] = value
|
44 |
|
45 |
-
# Display sidebar with navigation buttons
|
46 |
-
with st.sidebar:
|
47 |
-
st.header("Navigation")
|
48 |
-
if st.button("๐๏ธ Dataset Management"):
|
49 |
-
navigate("dataset_management")
|
50 |
-
if st.button("๐ฏ Model Training"):
|
51 |
-
navigate("model_training")
|
52 |
-
if st.button("๐ฎ Code Generation"):
|
53 |
-
navigate("code_generation")
|
54 |
|
55 |
-
# Render content dynamically based on session state
|
56 |
-
if st.session_state["current_page"] == "dataset_management":
|
57 |
-
st.subheader("Dataset Management")
|
58 |
-
st.write("Upload and manage your datasets here.")
|
59 |
-
elif st.session_state["current_page"] == "model_training":
|
60 |
-
st.subheader("Model Training")
|
61 |
-
st.write("Configure and train your models.")
|
62 |
-
elif st.session_state["current_page"] == "code_generation":
|
63 |
-
st.subheader("Code Generation")
|
64 |
-
st.write("Generate predictions using your trained models.")
|
65 |
-
else:
|
66 |
-
st.subheader("Getting Started")
|
67 |
-
col1, col2 = st.columns(2)
|
68 |
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
2. ๐ ๏ธ Configure and train your model in the **Model Training** section.
|
73 |
-
""")
|
74 |
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
|
81 |
-
# Display platform statistics
|
82 |
st.subheader("Platform Statistics")
|
83 |
col1, col2, col3 = st.columns(3)
|
84 |
|
85 |
with col1:
|
86 |
-
st.metric("
|
87 |
-
|
88 |
-
|
89 |
with col2:
|
90 |
-
st.metric("
|
91 |
-
|
92 |
-
|
93 |
with col3:
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
st.metric("
|
|
|
|
|
1 |
import streamlit as st
|
2 |
+
from utils import set_page_config, display_sidebar
|
3 |
+
import os
|
4 |
|
5 |
+
# Set page configuration
|
|
|
|
|
6 |
set_page_config()
|
7 |
|
8 |
+
# Title and description
|
9 |
st.title("CodeGen Hub")
|
|
|
|
|
10 |
st.markdown("""
|
11 |
Welcome to CodeGen Hub - A platform for training and using code generation models with Hugging Face integration.
|
12 |
+
|
13 |
### Core Features:
|
14 |
+
- Upload and preprocess Python code datasets for model training
|
15 |
+
- Configure and train models with customizable parameters
|
16 |
+
- Generate code predictions using trained models through an interactive interface
|
17 |
+
- Monitor training progress with visualizations and detailed logs
|
18 |
+
- Seamless integration with Hugging Face Hub for model management
|
19 |
+
|
20 |
Navigate through the different sections using the sidebar menu.
|
21 |
""")
|
22 |
|
23 |
+
# Display sidebar
|
24 |
+
display_sidebar()
|
25 |
|
26 |
+
# Create the session state for storing information across app pages
|
27 |
+
if 'datasets' not in st.session_state:
|
28 |
+
st.session_state.datasets = {}
|
29 |
|
30 |
+
if 'trained_models' not in st.session_state:
|
31 |
+
st.session_state.trained_models = {}
|
32 |
|
33 |
+
if 'training_logs' not in st.session_state:
|
34 |
+
st.session_state.training_logs = []
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
|
36 |
+
if 'training_progress' not in st.session_state:
|
37 |
+
st.session_state.training_progress = {}
|
|
|
38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
|
41 |
+
# Display getting started card
|
42 |
+
st.subheader("Getting Started")
|
43 |
+
col1, col2 = st.columns(2)
|
|
|
|
|
44 |
|
45 |
+
with col1:
|
46 |
+
st.info("""
|
47 |
+
1. ๐ Start by uploading or selecting a Python code dataset in the **Dataset Management** section.
|
48 |
+
2. ๐ ๏ธ Configure and train your model in the **Model Training** section.
|
49 |
+
""")
|
50 |
+
|
51 |
+
with col2:
|
52 |
+
st.info("""
|
53 |
+
3. ๐ก Generate code predictions using your trained models in the **Code Generation** section.
|
54 |
+
4. ๐ Access your models on Hugging Face Hub for broader use.
|
55 |
+
""")
|
56 |
|
57 |
+
# Display platform statistics if available
|
58 |
st.subheader("Platform Statistics")
|
59 |
col1, col2, col3 = st.columns(3)
|
60 |
|
61 |
with col1:
|
62 |
+
st.metric("Datasets Available", len(st.session_state.datasets))
|
63 |
+
|
|
|
64 |
with col2:
|
65 |
+
st.metric("Trained Models", len(st.session_state.trained_models))
|
66 |
+
|
|
|
67 |
with col3:
|
68 |
+
# Calculate active training jobs
|
69 |
+
active_jobs = sum(1 for progress in st.session_state.training_progress.values()
|
70 |
+
if progress.get('status') == 'running')
|
71 |
+
st.metric("Active Training Jobs", active_jobs)
|