raymondEDS commited on
Commit
6789180
Β·
verified Β·
1 Parent(s): 2865353

Update app/main.py

Browse files
Files changed (1) hide show
  1. app/main.py +23 -86
app/main.py CHANGED
@@ -89,26 +89,6 @@ if 'current_week' not in st.session_state:
89
  if 'logged_in' not in st.session_state:
90
  st.session_state.logged_in = False
91
 
92
- # Get class content
93
- def get_class_content(week_number):
94
- # Try different possible paths for class files
95
- possible_paths = [
96
- f"data_science_class_files/class_{week_number}", # Local development
97
- f"app/data_science_class_files/class_{week_number}", # Alternative local path
98
- f"class_{week_number}", # Streamlit Cloud deployment
99
- ]
100
-
101
- for class_dir in possible_paths:
102
- if os.path.exists(class_dir):
103
- # Get all files in the class directory
104
- files = glob.glob(f"{class_dir}/*")
105
- return {
106
- 'directory': class_dir,
107
- 'files': [os.path.basename(f) for f in files]
108
- }
109
-
110
- return None
111
-
112
  # Sidebar navigation
113
  def sidebar_navigation():
114
  with st.sidebar:
@@ -134,7 +114,7 @@ def sidebar_navigation():
134
  for week in range(1, 11):
135
  if st.button(f"Week {week}", key=f"week_{week}"):
136
  st.session_state.current_week = week
137
- st.rerun()
138
 
139
  # Main content
140
  def main():
@@ -147,74 +127,31 @@ def main():
147
  # User is logged in, show course content
148
  st.title("Data Science Research Paper Course")
149
 
150
- # Welcome message for first-time visitors
151
- if st.session_state.current_week == 1:
152
- st.markdown("""
153
- ## Welcome to the Data Science Research Paper Course! πŸ“š
154
-
155
- This 10-week course will guide you through the process of creating a machine learning research paper.
156
- Each week, you'll learn new concepts and complete tasks that build upon each other.
157
-
158
- ### Getting Started
159
- 1. Use the sidebar to navigate between weeks
160
- 2. Complete the weekly tasks and assignments
161
- 3. Track your progress using the progress bar
162
- 4. Submit your work for feedback
163
-
164
- ### Course Overview
165
- - Week 1: Research Topic Selection and Literature Review
166
- - Week 2: Data Collection and Preprocessing
167
- - Week 3: Exploratory Data Analysis
168
- - Week 4: Feature Engineering
169
- - Week 5: Model Selection and Baseline
170
- - Week 6: Model Training and Optimization
171
- - Week 7: Model Evaluation
172
- - Week 8: Results Analysis
173
- - Week 9: Paper Writing
174
- - Week 10: Final Review and Submission
175
- """)
176
 
177
- # Display current week's content
178
- st.markdown(f"## Week {st.session_state.current_week}")
179
 
180
- # Get class content
181
- class_content = get_class_content(st.session_state.current_week)
 
 
 
182
 
183
- if class_content:
184
- st.subheader("Class Materials")
185
-
186
- # Display files in the class directory
187
- for file in class_content['files']:
188
- file_path = os.path.join(class_content['directory'], file)
189
-
190
- # Handle different file types
191
- if file.endswith('.py'):
192
- try:
193
- with open(file_path, 'r') as f:
194
- st.code(f.read(), language='python')
195
- except Exception as e:
196
- st.error(f"Error reading file {file}: {str(e)}")
197
- elif file.endswith('.md'):
198
- try:
199
- with open(file_path, 'r') as f:
200
- st.markdown(f.read())
201
- except Exception as e:
202
- st.error(f"Error reading file {file}: {str(e)}")
203
- elif file.endswith(('.pptx', '.pdf', '.doc', '.docx')):
204
- try:
205
- with open(file_path, 'rb') as f:
206
- st.download_button(
207
- label=f"Download {file}",
208
- data=f.read(),
209
- file_name=file,
210
- mime='application/octet-stream'
211
- )
212
- except Exception as e:
213
- st.error(f"Error reading file {file}: {str(e)}")
214
- else:
215
- st.write(f"- {file}")
216
- else:
217
- st.info("Content for this week is being prepared. Check back soon!")
218
 
219
  if __name__ == "__main__":
220
  load_css()
 
89
  if 'logged_in' not in st.session_state:
90
  st.session_state.logged_in = False
91
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92
  # Sidebar navigation
93
  def sidebar_navigation():
94
  with st.sidebar:
 
114
  for week in range(1, 11):
115
  if st.button(f"Week {week}", key=f"week_{week}"):
116
  st.session_state.current_week = week
117
+ st.switch_page(f"app/pages/{week}_Week_{week}.py")
118
 
119
  # Main content
120
  def main():
 
127
  # User is logged in, show course content
128
  st.title("Data Science Research Paper Course")
129
 
130
+ # Welcome message
131
+ st.markdown("""
132
+ ## Welcome to the Data Science Research Paper Course! πŸ“š
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
133
 
134
+ This 10-week course will guide you through the process of creating a machine learning research paper.
135
+ Each week, you'll learn new concepts and complete tasks that build upon each other.
136
 
137
+ ### Getting Started
138
+ 1. Use the sidebar to navigate between weeks
139
+ 2. Complete the weekly tasks and assignments
140
+ 3. Track your progress using the progress bar
141
+ 4. Submit your work for feedback
142
 
143
+ ### Course Overview
144
+ - Week 1: Research Topic Selection and Literature Review
145
+ - Week 2: Data Collection and Preprocessing
146
+ - Week 3: Exploratory Data Analysis
147
+ - Week 4: Feature Engineering
148
+ - Week 5: Model Selection and Baseline
149
+ - Week 6: Model Training and Optimization
150
+ - Week 7: Model Evaluation
151
+ - Week 8: Results Analysis
152
+ - Week 9: Paper Writing
153
+ - Week 10: Final Review and Submission
154
+ """)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
155
 
156
  if __name__ == "__main__":
157
  load_css()