Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
|
| 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("π
|
| 418 |
st.session_state.show_topics = True
|
| 419 |
|
| 420 |
-
if st.button("π‘ Get
|
| 421 |
random_questions = [
|
| 422 |
-
"What are
|
| 423 |
-
"
|
| 424 |
-
"What
|
| 425 |
-
"
|
| 426 |
-
"What
|
| 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
|
| 495 |
-
- **
|
| 496 |
-
- **
|
| 497 |
-
- **
|
| 498 |
-
- **
|
| 499 |
|
| 500 |
-
π **
|
| 501 |
""")
|
| 502 |
|
| 503 |
# Sample questions
|
| 504 |
st.markdown("### π‘ Try these sample questions:")
|
| 505 |
sample_questions = [
|
| 506 |
-
"What
|
| 507 |
-
"
|
| 508 |
-
"
|
| 509 |
-
"
|
| 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
|
| 522 |
st.markdown("""
|
| 523 |
-
Based on
|
| 524 |
-
-
|
| 525 |
-
-
|
| 526 |
-
-
|
| 527 |
-
-
|
| 528 |
-
-
|
| 529 |
-
-
|
| 530 |
-
- And much more!
|
| 531 |
|
| 532 |
-
*Ask me
|
| 533 |
""")
|
| 534 |
-
if st.button("Close
|
| 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
|
| 570 |
-
placeholder="e.g.,
|
| 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
|
| 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
|
| 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> |
|
| 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)
|