ZunairaHawwar commited on
Commit
b6e8b03
Β·
verified Β·
1 Parent(s): 50adcc7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +34 -35
app.py CHANGED
@@ -371,7 +371,7 @@ def main():
371
  st.markdown("""
372
  <div class="main-header">
373
  <h1>πŸŽ“ EduBot for iCodeGuru</h1>
374
- <p>Powered by LangChain | Your AI Programming Assistant</p>
375
  </div>
376
  """, unsafe_allow_html=True)
377
 
@@ -414,16 +414,16 @@ def main():
414
 
415
  # Quick Actions
416
  st.markdown("### ⚑ Quick Actions")
417
- if st.button("πŸ“š Show Available Topics", use_container_width=True):
418
  st.session_state.show_topics = True
419
 
420
- if st.button("πŸ’‘ Get Random Tip", use_container_width=True):
421
  random_questions = [
422
- "What are the best programming practices?",
423
- "How to optimize code performance?",
424
- "What are common coding mistakes?",
425
- "Explain object-oriented programming",
426
- "What is the difference between frontend and backend?"
427
  ]
428
  import random
429
  random_q = random.choice(random_questions)
@@ -489,24 +489,24 @@ def main():
489
  # Welcome message for new users
490
  if len(st.session_state.messages) == 0:
491
  st.markdown("""
492
- ### πŸ‘‹ Welcome to EduBot!
493
 
494
- I'm your AI programming assistant, ready to help you with:
495
- - **Programming concepts** and tutorials
496
- - **Code examples** and best practices
497
- - **Debugging** and troubleshooting
498
- - **Learning resources** and recommendations
499
 
500
- πŸš€ **Get started by asking me anything about programming!**
501
  """)
502
 
503
  # Sample questions
504
  st.markdown("### πŸ’‘ Try these sample questions:")
505
  sample_questions = [
506
- "What is Python?",
507
- "How to create a REST API?",
508
- "Explain machine learning basics",
509
- "Best practices for web development"
510
  ]
511
 
512
  cols = st.columns(2)
@@ -518,20 +518,19 @@ def main():
518
 
519
  # Show topics if requested
520
  if st.session_state.get("show_topics", False):
521
- with st.expander("πŸ“š Available Topics", expanded=True):
522
  st.markdown("""
523
- Based on your knowledge base, I can help with:
524
- - Web Development (HTML, CSS, JavaScript)
525
- - Python Programming
526
- - Data Science & Machine Learning
527
- - Database Management
528
- - Software Engineering Practices
529
- - API Development
530
- - And much more!
531
 
532
- *Ask me anything specific about these topics!*
533
  """)
534
- if st.button("Close Topics"):
535
  st.session_state.show_topics = False
536
  st.rerun()
537
 
@@ -566,8 +565,8 @@ def main():
566
 
567
  with col1:
568
  user_input = st.text_input(
569
- "πŸ’¬ Ask your question:",
570
- placeholder="e.g., How do I create a Python function?",
571
  key="user_input"
572
  )
573
 
@@ -575,7 +574,7 @@ def main():
575
  send_button = st.button("Send πŸš€", type="primary", use_container_width=True)
576
 
577
  # Alternative chat input (modern style)
578
- if prompt := st.chat_input("πŸ’¬ Ask anything about programming..."):
579
  user_input = prompt
580
  send_button = True
581
 
@@ -594,7 +593,7 @@ def main():
594
  with st.chat_message("assistant"):
595
  with st.spinner("πŸ€” Let me think about that..."):
596
  response = rag_system.get_answer(question)
597
- answer = response.get("answer", "I couldn't find an answer to that question.")
598
  source_docs = response.get("source_documents", [])
599
 
600
  st.markdown(answer)
@@ -636,7 +635,7 @@ def main():
636
  st.markdown("---")
637
  st.markdown("""
638
  <div style="text-align: center; color: #666; padding: 1rem;">
639
- <p>πŸŽ“ <strong>EduBot for iCodeGuru</strong> | Empowering developers worldwide</p>
640
  <p>Made with ❀️ using Streamlit β€’ LangChain β€’ ChromaDB β€’ Groq</p>
641
  </div>
642
  """, unsafe_allow_html=True)
 
371
  st.markdown("""
372
  <div class="main-header">
373
  <h1>πŸŽ“ EduBot for iCodeGuru</h1>
374
+ <p>Powered by LangChain | Ask questions based on iCodeGuru's knowledge base</p>
375
  </div>
376
  """, unsafe_allow_html=True)
377
 
 
414
 
415
  # Quick Actions
416
  st.markdown("### ⚑ Quick Actions")
417
+ if st.button("πŸ“š Browse Available Content", use_container_width=True):
418
  st.session_state.show_topics = True
419
 
420
+ if st.button("πŸ’‘ Get Sample Question", use_container_width=True):
421
  random_questions = [
422
+ "What tutorials are available in iCodeGuru?",
423
+ "Show me resources about web development",
424
+ "What programming languages does iCodeGuru cover?",
425
+ "Find me beginner-friendly content",
426
+ "What are the latest tutorials added?"
427
  ]
428
  import random
429
  random_q = random.choice(random_questions)
 
489
  # Welcome message for new users
490
  if len(st.session_state.messages) == 0:
491
  st.markdown("""
492
+ ### πŸ‘‹ Welcome to iCodeGuru EduBot!
493
 
494
+ I'm your knowledge assistant for iCodeGuru content. I can help you find:
495
+ - **Tutorials and courses** from iCodeGuru
496
+ - **Specific topics** and learning materials
497
+ - **Resources and references** from the knowledge base
498
+ - **Answers** based on iCodeGuru's educational content
499
 
500
+ πŸš€ **Ask me anything about iCodeGuru's content!**
501
  """)
502
 
503
  # Sample questions
504
  st.markdown("### πŸ’‘ Try these sample questions:")
505
  sample_questions = [
506
+ "What tutorials are available?",
507
+ "Show me Python resources",
508
+ "Find web development content",
509
+ "What beginner courses exist?"
510
  ]
511
 
512
  cols = st.columns(2)
 
518
 
519
  # Show topics if requested
520
  if st.session_state.get("show_topics", False):
521
+ with st.expander("πŸ“š Available iCodeGuru Content", expanded=True):
522
  st.markdown("""
523
+ Based on iCodeGuru's knowledge base, I can help you find:
524
+ - **Video Tutorials** and course materials
525
+ - **Programming Languages** covered by iCodeGuru
526
+ - **Project Examples** and case studies
527
+ - **Learning Paths** and structured content
528
+ - **Tips and Tricks** from iCodeGuru experts
529
+ - **Resource Links** and references
 
530
 
531
+ *Ask me to find specific content from iCodeGuru's library!*
532
  """)
533
+ if st.button("Close Content Browser"):
534
  st.session_state.show_topics = False
535
  st.rerun()
536
 
 
565
 
566
  with col1:
567
  user_input = st.text_input(
568
+ "πŸ’¬ Ask about iCodeGuru content:",
569
+ placeholder="e.g., Show me Python tutorials from iCodeGuru",
570
  key="user_input"
571
  )
572
 
 
574
  send_button = st.button("Send πŸš€", type="primary", use_container_width=True)
575
 
576
  # Alternative chat input (modern style)
577
+ if prompt := st.chat_input("πŸ’¬ Ask about iCodeGuru's knowledge base..."):
578
  user_input = prompt
579
  send_button = True
580
 
 
593
  with st.chat_message("assistant"):
594
  with st.spinner("πŸ€” Let me think about that..."):
595
  response = rag_system.get_answer(question)
596
+ answer = response.get("answer", "I couldn't find that information in iCodeGuru's knowledge base.")
597
  source_docs = response.get("source_documents", [])
598
 
599
  st.markdown(answer)
 
635
  st.markdown("---")
636
  st.markdown("""
637
  <div style="text-align: center; color: #666; padding: 1rem;">
638
+ <p>πŸŽ“ <strong>EduBot for iCodeGuru</strong> | Your gateway to iCodeGuru's knowledge</p>
639
  <p>Made with ❀️ using Streamlit β€’ LangChain β€’ ChromaDB β€’ Groq</p>
640
  </div>
641
  """, unsafe_allow_html=True)