Niharmahesh commited on
Commit
3b8e24a
·
verified ·
1 Parent(s): 69d0951

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +66 -3
app.py CHANGED
@@ -1,8 +1,9 @@
1
-
2
  import streamlit as st
3
  from PIL import Image
4
  from streamlit_lottie import st_lottie
5
  import json
 
 
6
  from streamlit_option_menu import option_menu
7
  from projects import display_projects
8
 
@@ -47,6 +48,7 @@ def display_education():
47
  - Memeber of the Robotics Club:, built line follower and theft-alert detection bots.
48
  - Member of the college cricket team; won the Hyderabad zone-level tournament
49
  """)
 
50
  def display_work_experience():
51
  st.markdown('## Work Experience')
52
  st.write("""
@@ -65,7 +67,7 @@ def display_work_experience():
65
  - **Teaching Assistant**
66
  - Mentored 80+ graduate students on data modeling projects, providing feedback on technical documentation
67
  - Reviewed and debugged student data pipelines, offering solutions for data analysis and ML model challenges
68
- - Improved student performance, with 75% of mentored students achieving an A grade
69
  -Conducted weekly office hours to assist students with complex data science concepts and project implementations
70
 
71
  **Bharat Electronics Limited, Hyderabad, India**
@@ -262,7 +264,65 @@ def display_skills():
262
  - Anomaly Detection
263
  """)
264
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
265
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
266
  def display_apps():
267
  st.markdown('## Apps')
268
  st.markdown("""
@@ -297,11 +357,14 @@ def display_social_media():
297
  - [Twitter](https://twitter.com/niharpalem_2497)
298
  - [Email](mailto:sainiharreddy.palem@sjsu.edu)
299
  """)
 
 
300
  menu_items_with_icons = {
301
  "🎓": display_education,
302
  "💼": display_work_experience,
303
  "📁": display_projects,
304
  "🛠️": display_skills,
 
305
  "🌐": display_social_media,
306
  "🏆": display_certifications,
307
  "📱": display_apps
@@ -330,4 +393,4 @@ def main():
330
  st.session_state.selected_function()
331
 
332
  if __name__ == "__main__":
333
- main()
 
 
1
  import streamlit as st
2
  from PIL import Image
3
  from streamlit_lottie import st_lottie
4
  import json
5
+ import os
6
+ import glob
7
  from streamlit_option_menu import option_menu
8
  from projects import display_projects
9
 
 
48
  - Memeber of the Robotics Club:, built line follower and theft-alert detection bots.
49
  - Member of the college cricket team; won the Hyderabad zone-level tournament
50
  """)
51
+
52
  def display_work_experience():
53
  st.markdown('## Work Experience')
54
  st.write("""
 
67
  - **Teaching Assistant**
68
  - Mentored 80+ graduate students on data modeling projects, providing feedback on technical documentation
69
  - Reviewed and debugged student data pipelines, offering solutions for data analysis and ML model challenges
70
+ - Improved student performance, with 75% of mentored students achieving an 'A' grade
71
  -Conducted weekly office hours to assist students with complex data science concepts and project implementations
72
 
73
  **Bharat Electronics Limited, Hyderabad, India**
 
264
  - Anomaly Detection
265
  """)
266
 
267
+ def display_articles():
268
+ """Display articles from HTML files in the articles directory"""
269
+ st.markdown('## Articles')
270
+
271
+ # Define the articles directory path
272
+ articles_dir = "articles" # You can change this path as needed
273
+
274
+ # Check if articles directory exists
275
+ if not os.path.exists(articles_dir):
276
+ st.warning(f"Articles directory '{articles_dir}' not found. Please create the directory and add your HTML files.")
277
+ st.info("Create an 'articles' folder in your project directory and add your HTML files there.")
278
+ return
279
+
280
+ # Get all HTML files from the articles directory
281
+ html_files = glob.glob(os.path.join(articles_dir, "*.html"))
282
+
283
+ if not html_files:
284
+ st.info("No HTML articles found in the articles directory. Add some .html files to get started!")
285
+ return
286
+
287
+ # Sort files by name for consistent ordering
288
+ html_files.sort()
289
+
290
+ # Create a selectbox to choose which article to display
291
+ if len(html_files) > 1:
292
+ # Extract just the filename without path and extension for display
293
+ file_options = [os.path.splitext(os.path.basename(f))[0].replace('_', ' ').title() for f in html_files]
294
 
295
+ selected_article = st.selectbox(
296
+ "Choose an article to read:",
297
+ options=range(len(html_files)),
298
+ format_func=lambda x: file_options[x]
299
+ )
300
+
301
+ selected_file = html_files[selected_article]
302
+ else:
303
+ selected_file = html_files[0]
304
+
305
+ # Display the selected article
306
+ try:
307
+ with open(selected_file, 'r', encoding='utf-8') as file:
308
+ html_content = file.read()
309
+
310
+ # Display the HTML content
311
+ st.markdown("---")
312
+ st.components.v1.html(html_content, height=600, scrolling=True)
313
+
314
+ # Add download button
315
+ st.download_button(
316
+ label="Download Article",
317
+ data=html_content,
318
+ file_name=os.path.basename(selected_file),
319
+ mime="text/html"
320
+ )
321
+
322
+ except Exception as e:
323
+ st.error(f"Error loading article: {str(e)}")
324
+ st.info("Make sure your HTML files are properly formatted and encoded in UTF-8.")
325
+
326
  def display_apps():
327
  st.markdown('## Apps')
328
  st.markdown("""
 
357
  - [Twitter](https://twitter.com/niharpalem_2497)
358
  - [Email](mailto:sainiharreddy.palem@sjsu.edu)
359
  """)
360
+
361
+ # Updated menu with articles section
362
  menu_items_with_icons = {
363
  "🎓": display_education,
364
  "💼": display_work_experience,
365
  "📁": display_projects,
366
  "🛠️": display_skills,
367
+ "📝": display_articles, # New articles section
368
  "🌐": display_social_media,
369
  "🏆": display_certifications,
370
  "📱": display_apps
 
393
  st.session_state.selected_function()
394
 
395
  if __name__ == "__main__":
396
+ main()