Spaces:
Sleeping
Sleeping
Commit ·
04d9c3b
1
Parent(s): 56130ed
UI Improvements
Browse files
app.py
CHANGED
|
@@ -694,118 +694,61 @@ with gr.Blocks(css=custom_css, theme=theme) as demo:
|
|
| 694 |
""")
|
| 695 |
|
| 696 |
# ══════════════════════════════════════════
|
| 697 |
-
#
|
| 698 |
# ══════════════════════════════════════════
|
| 699 |
-
with gr.
|
| 700 |
-
|
| 701 |
-
|
| 702 |
-
|
| 703 |
-
|
| 704 |
-
|
| 705 |
-
|
| 706 |
-
|
| 707 |
-
|
| 708 |
-
|
| 709 |
-
|
| 710 |
-
|
| 711 |
-
|
| 712 |
-
<
|
| 713 |
-
<div class="topic-chip"><span class="topic-icon">📋</span> HR Procedures</div>
|
| 714 |
-
<div class="topic-chip"><span class="topic-icon">🔄</span> Probation & Onboarding</div>
|
| 715 |
-
<div class="alert-box">
|
| 716 |
-
<p>⚠️ This assistant exclusively answers DDS HR handbook questions. For confidential queries, email connect@decodingdatascience.com</p>
|
| 717 |
-
</div>
|
| 718 |
-
""")
|
| 719 |
-
|
| 720 |
-
# RIGHT CHAT PANEL
|
| 721 |
-
with gr.Column(scale=2, elem_classes="chat-card"):
|
| 722 |
-
question = gr.Textbox(
|
| 723 |
-
label="Ask Your HR Question",
|
| 724 |
-
placeholder="e.g. How do I apply for annual leave? What is the WFH policy?",
|
| 725 |
-
lines=3,
|
| 726 |
-
elem_classes="ask-box"
|
| 727 |
-
)
|
| 728 |
-
|
| 729 |
-
answer = gr.Textbox(
|
| 730 |
-
label="DORA's Response",
|
| 731 |
-
lines=10,
|
| 732 |
-
elem_classes="response-box"
|
| 733 |
-
)
|
| 734 |
-
|
| 735 |
-
with gr.Row():
|
| 736 |
-
ask_btn = gr.Button("🚀 Send Question", variant="primary", elem_classes="btn-ask")
|
| 737 |
-
clear_btn = gr.Button("✕ Clear", elem_classes="btn-clear")
|
| 738 |
-
|
| 739 |
-
gr.Examples(
|
| 740 |
-
label="Quick Questions",
|
| 741 |
-
examples=[
|
| 742 |
-
["What is the annual leave policy?"],
|
| 743 |
-
["How do I apply for medical leave?"],
|
| 744 |
-
["What are the working hours?"],
|
| 745 |
-
["What is the probation period?"],
|
| 746 |
-
["What is the work from home policy?"],
|
| 747 |
-
],
|
| 748 |
-
inputs=question
|
| 749 |
-
)
|
| 750 |
-
|
| 751 |
-
ask_btn.click(fn=query_doc, inputs=question, outputs=answer)
|
| 752 |
-
question.submit(fn=query_doc, inputs=question, outputs=answer)
|
| 753 |
-
clear_btn.click(lambda: ("", ""), outputs=[question, answer])
|
| 754 |
-
|
| 755 |
-
# ─── FAQ TAB ───
|
| 756 |
-
with gr.Tab("❓ FAQs"):
|
| 757 |
-
gr.HTML("""
|
| 758 |
-
<div style="max-width:760px;">
|
| 759 |
-
<p style="font-family:Sora,sans-serif;font-size:11px;font-weight:600;letter-spacing:2.5px;text-transform:uppercase;color:rgba(99,179,255,0.55);margin-bottom:20px;">Frequently Asked Questions</p>
|
| 760 |
-
|
| 761 |
-
<div style="background:rgba(56,130,246,0.07);border:1px solid rgba(56,130,246,0.15);border-radius:12px;padding:18px 20px;margin-bottom:10px;">
|
| 762 |
-
<p style="font-size:14px;font-weight:600;color:#a8d4ff;margin-bottom:6px;">What topics can DORA answer?</p>
|
| 763 |
-
<p style="font-size:13px;color:rgba(170,205,245,0.65);line-height:1.7;margin:0;">DORA exclusively answers questions based on the DDS HR Handbook — covering leave policies, WFH rules, attendance, benefits, probation, and HR procedures.</p>
|
| 764 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 765 |
|
| 766 |
-
<div style="background:rgba(56,130,246,0.07);border:1px solid rgba(56,130,246,0.15);border-radius:12px;padding:18px 20px;margin-bottom:10px;">
|
| 767 |
-
<p style="font-size:14px;font-weight:600;color:#a8d4ff;margin-bottom:6px;">Can DORA provide salary or confidential details?</p>
|
| 768 |
-
<p style="font-size:13px;color:rgba(170,205,245,0.65);line-height:1.7;margin:0;">No. Salary ranges, performance reviews, and confidential HR data are outside DORA's scope. Please email connect@decodingdatascience.com for such queries.</p>
|
| 769 |
-
</div>
|
| 770 |
-
|
| 771 |
-
<div style="background:rgba(56,130,246,0.07);border:1px solid rgba(56,130,246,0.15);border-radius:12px;padding:18px 20px;margin-bottom:10px;">
|
| 772 |
-
<p style="font-size:14px;font-weight:600;color:#a8d4ff;margin-bottom:6px;">What happens if I ask something outside HR?</p>
|
| 773 |
-
<p style="font-size:13px;color:rgba(170,205,245,0.65);line-height:1.7;margin:0;">DORA will politely decline and redirect you to the appropriate HR contact, without answering out-of-scope queries.</p>
|
| 774 |
-
</div>
|
| 775 |
|
| 776 |
-
<div style="background:rgba(56,130,246,0.07);border:1px solid rgba(56,130,246,0.15);border-radius:12px;padding:18px 20px;margin-bottom:10px;">
|
| 777 |
-
<p style="font-size:14px;font-weight:600;color:#a8d4ff;margin-bottom:6px;">Who do I contact for urgent HR issues?</p>
|
| 778 |
-
<p style="font-size:13px;color:rgba(170,205,245,0.65);line-height:1.7;margin:0;">📧 connect@decodingdatascience.com — for confidential matters, escalations, or questions outside the handbook.</p>
|
| 779 |
-
</div>
|
| 780 |
-
|
| 781 |
-
<div style="background:rgba(56,130,246,0.07);border:1px solid rgba(56,130,246,0.15);border-radius:12px;padding:18px 20px;margin-bottom:10px;">
|
| 782 |
-
<p style="font-size:14px;font-weight:600;color:#a8d4ff;margin-bottom:6px;">How does DORA find answers?</p>
|
| 783 |
-
<p style="font-size:13px;color:rgba(170,205,245,0.65);line-height:1.7;margin:0;">DORA uses Retrieval-Augmented Generation (RAG): your question is matched against the DDS HR Handbook stored in Pinecone vector database, and GPT-4o mini generates a precise answer from the retrieved context.</p>
|
| 784 |
-
</div>
|
| 785 |
-
</div>
|
| 786 |
-
""")
|
| 787 |
-
|
| 788 |
-
# ─── ABOUT TAB ───
|
| 789 |
-
with gr.Tab("ℹ️ About"):
|
| 790 |
-
gr.HTML("""
|
| 791 |
-
<div style="max-width:720px;">
|
| 792 |
-
<p style="font-family:Sora,sans-serif;font-size:11px;font-weight:600;letter-spacing:2.5px;text-transform:uppercase;color:rgba(99,179,255,0.55);margin-bottom:16px;">About This Project</p>
|
| 793 |
-
<p style="font-size:20px;font-weight:600;color:#c8e0ff;font-family:Sora,sans-serif;margin-bottom:8px;">DORA — DDS Organizational Resources Assistant</p>
|
| 794 |
-
<p style="font-size:14px;color:rgba(170,205,245,0.6);line-height:1.75;margin-bottom:24px;font-weight:300;">
|
| 795 |
-
An enterprise-grade AI chatbot that gives DDS employees instant, accurate access to HR policies — powered by a RAG pipeline built on LlamaIndex, Pinecone, and OpenAI.
|
| 796 |
-
</p>
|
| 797 |
-
<div style="display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-bottom:24px;">
|
| 798 |
-
<div style="background:rgba(56,130,246,0.07);border:1px solid rgba(56,130,246,0.15);border-radius:14px;padding:16px;">
|
| 799 |
-
<p style="font-size:11px;letter-spacing:2px;text-transform:uppercase;color:rgba(99,179,255,0.5);font-weight:600;margin-bottom:10px;">✅ Capabilities</p>
|
| 800 |
-
<p style="font-size:13px;color:rgba(180,215,255,0.7);line-height:1.8;font-weight:300;">• Instant HR policy answers<br>• Handbook-grounded responses<br>• Semantic vector search<br>• Chain-of-thought reasoning<br>• Polite out-of-scope handling</p>
|
| 801 |
-
</div>
|
| 802 |
-
<div style="background:rgba(234,179,8,0.05);border:1px solid rgba(234,179,8,0.12);border-radius:14px;padding:16px;">
|
| 803 |
-
<p style="font-size:11px;letter-spacing:2px;text-transform:uppercase;color:rgba(252,211,77,0.5);font-weight:600;margin-bottom:10px;">⚙️ Tech Stack</p>
|
| 804 |
-
<p style="font-size:13px;color:rgba(200,220,255,0.65);line-height:1.8;font-weight:300;">• LlamaIndex RAG pipeline<br>• Pinecone vector database<br>• GPT-4o mini (OpenAI)<br>• text-embedding-ada-002<br>• Gradio UI + HuggingFace</p>
|
| 805 |
-
</div>
|
| 806 |
-
</div>
|
| 807 |
-
</div>
|
| 808 |
-
""")
|
| 809 |
|
| 810 |
# ══════════════════════════════════════════
|
| 811 |
# FOOTER
|
|
@@ -814,60 +757,60 @@ with gr.Blocks(css=custom_css, theme=theme) as demo:
|
|
| 814 |
<div class="dora-footer">
|
| 815 |
<div class="footer-grid">
|
| 816 |
|
| 817 |
-
|
| 818 |
-
|
| 819 |
-
|
| 820 |
-
|
| 821 |
-
|
| 822 |
-
|
| 823 |
-
|
| 824 |
-
|
| 825 |
-
|
| 826 |
-
|
| 827 |
-
|
| 828 |
-
|
| 829 |
-
|
| 830 |
-
|
| 831 |
-
</div>
|
| 832 |
</div>
|
|
|
|
| 833 |
|
| 834 |
-
|
| 835 |
-
|
| 836 |
-
|
| 837 |
-
|
| 838 |
-
|
| 839 |
-
|
| 840 |
-
|
| 841 |
-
|
| 842 |
-
|
| 843 |
-
|
| 844 |
-
|
| 845 |
-
|
| 846 |
-
|
| 847 |
-
|
| 848 |
-
|
| 849 |
-
|
| 850 |
|
| 851 |
-
|
| 852 |
-
|
| 853 |
-
|
| 854 |
-
|
| 855 |
-
|
| 856 |
-
|
| 857 |
-
|
| 858 |
-
|
| 859 |
-
|
| 860 |
-
|
| 861 |
-
|
| 862 |
-
|
| 863 |
-
|
| 864 |
-
</div>
|
| 865 |
</div>
|
| 866 |
</div>
|
|
|
|
| 867 |
|
| 868 |
<div class="footer-bottom">
|
| 869 |
-
|
| 870 |
-
|
| 871 |
</div>
|
| 872 |
</div>
|
| 873 |
""")
|
|
|
|
| 694 |
""")
|
| 695 |
|
| 696 |
# ══════════════════════════════════════════
|
| 697 |
+
# CHAT
|
| 698 |
# ══════════════════════════════════════════
|
| 699 |
+
with gr.Row(equal_height=True):
|
| 700 |
+
|
| 701 |
+
# LEFT SIDEBAR
|
| 702 |
+
with gr.Column(scale=1, elem_classes="sidebar-panel"):
|
| 703 |
+
gr.HTML("""
|
| 704 |
+
<p class="sidebar-section-title">📌 Supported Topics</p>
|
| 705 |
+
<div class="topic-chip"><span class="topic-icon">🏖️</span> Leave Policies</div>
|
| 706 |
+
<div class="topic-chip"><span class="topic-icon">🏠</span> Work From Home Rules</div>
|
| 707 |
+
<div class="topic-chip"><span class="topic-icon">🕐</span> Attendance Guidelines</div>
|
| 708 |
+
<div class="topic-chip"><span class="topic-icon">🎁</span> Employee Benefits</div>
|
| 709 |
+
<div class="topic-chip"><span class="topic-icon">📋</span> HR Procedures</div>
|
| 710 |
+
<div class="topic-chip"><span class="topic-icon">🔄</span> Probation & Onboarding</div>
|
| 711 |
+
<div class="alert-box">
|
| 712 |
+
<p>⚠️ This assistant exclusively answers DDS HR handbook questions. For confidential queries, email connect@decodingdatascience.com</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 713 |
</div>
|
| 714 |
+
""")
|
| 715 |
+
|
| 716 |
+
# RIGHT CHAT PANEL
|
| 717 |
+
with gr.Column(scale=2, elem_classes="chat-card"):
|
| 718 |
+
question = gr.Textbox(
|
| 719 |
+
label="Ask Your HR Question",
|
| 720 |
+
placeholder="e.g. How do I apply for annual leave? What is the WFH policy?",
|
| 721 |
+
lines=3,
|
| 722 |
+
elem_classes="ask-box"
|
| 723 |
+
)
|
| 724 |
+
|
| 725 |
+
answer = gr.Textbox(
|
| 726 |
+
label="DORA's Response",
|
| 727 |
+
lines=10,
|
| 728 |
+
elem_classes="response-box"
|
| 729 |
+
)
|
| 730 |
+
|
| 731 |
+
with gr.Row():
|
| 732 |
+
ask_btn = gr.Button("🚀 Send Question", variant="primary", elem_classes="btn-ask")
|
| 733 |
+
clear_btn = gr.Button("✕ Clear", elem_classes="btn-clear")
|
| 734 |
+
|
| 735 |
+
gr.Examples(
|
| 736 |
+
label="Quick Questions",
|
| 737 |
+
examples=[
|
| 738 |
+
["What is the annual leave policy?"],
|
| 739 |
+
["How do I apply for medical leave?"],
|
| 740 |
+
["What are the working hours?"],
|
| 741 |
+
["What is the probation period?"],
|
| 742 |
+
["What is the work from home policy?"],
|
| 743 |
+
],
|
| 744 |
+
inputs=question
|
| 745 |
+
)
|
| 746 |
+
|
| 747 |
+
ask_btn.click(fn=query_doc, inputs=question, outputs=answer)
|
| 748 |
+
question.submit(fn=query_doc, inputs=question, outputs=answer)
|
| 749 |
+
clear_btn.click(lambda: ("", ""), outputs=[question, answer])
|
| 750 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 751 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 752 |
|
| 753 |
# ══════════════════════════════════════════
|
| 754 |
# FOOTER
|
|
|
|
| 757 |
<div class="dora-footer">
|
| 758 |
<div class="footer-grid">
|
| 759 |
|
| 760 |
+
<!-- COL 1: Developer -->
|
| 761 |
+
<div>
|
| 762 |
+
<p class="footer-col-title">Developer</p>
|
| 763 |
+
<p class="footer-about-name">Nipun Kavinda</p>
|
| 764 |
+
<p class="footer-about-role">AI & Data Science Engineer</p>
|
| 765 |
+
<p class="footer-about-desc">
|
| 766 |
+
Building intelligent enterprise solutions at the intersection of LLMs, RAG pipelines, and production-grade AI systems.
|
| 767 |
+
Passionate about making AI practical and accessible.
|
| 768 |
+
</p>
|
| 769 |
+
<div style="margin-top:14px;display:flex;gap:8px;flex-wrap:wrap;">
|
| 770 |
+
<span class="footer-tech-pill">🐍 Python</span>
|
| 771 |
+
<span class="footer-tech-pill">🦙 LlamaIndex</span>
|
| 772 |
+
<span class="footer-tech-pill">🌲 Pinecone</span>
|
| 773 |
+
<span class="footer-tech-pill">🤖 OpenAI</span>
|
|
|
|
| 774 |
</div>
|
| 775 |
+
</div>
|
| 776 |
|
| 777 |
+
<!-- COL 2: Project -->
|
| 778 |
+
<div>
|
| 779 |
+
<p class="footer-col-title">Project</p>
|
| 780 |
+
<a class="footer-link" href="#">
|
| 781 |
+
<span class="link-icon">📁</span> DORA v1.0 — HR Chatbot
|
| 782 |
+
</a>
|
| 783 |
+
<a class="footer-link" href="#">
|
| 784 |
+
<span class="link-icon">🔗</span> HuggingFace Space
|
| 785 |
+
</a>
|
| 786 |
+
<a class="footer-link" href="#">
|
| 787 |
+
<span class="link-icon">📄</span> DDS HR Handbook
|
| 788 |
+
</a>
|
| 789 |
+
<a class="footer-link" href="mailto:connect@decodingdatascience.com">
|
| 790 |
+
<span class="link-icon">✉️</span> connect@decodingdatascience.com
|
| 791 |
+
</a>
|
| 792 |
+
</div>
|
| 793 |
|
| 794 |
+
<!-- COL 3: Organization -->
|
| 795 |
+
<div>
|
| 796 |
+
<p class="footer-col-title">Organization</p>
|
| 797 |
+
<p style="font-family:Sora,sans-serif;font-size:14px;font-weight:600;color:#a8ceff;margin-bottom:4px;">Decoding Data Science</p>
|
| 798 |
+
<p style="font-size:12px;color:rgba(140,180,230,0.45);margin-bottom:12px;font-weight:300;">Enterprise AI Division</p>
|
| 799 |
+
<a class="footer-link" href="https://decodingdatascience.com" target="_blank">
|
| 800 |
+
<span class="link-icon">🌐</span> decodingdatascience.com
|
| 801 |
+
</a>
|
| 802 |
+
<a class="footer-link" href="mailto:connect@decodingdatascience.com">
|
| 803 |
+
<span class="link-icon">📧</span> HR Support Email
|
| 804 |
+
</a>
|
| 805 |
+
<div style="margin-top:14px;padding:10px 13px;background:rgba(34,197,94,0.07);border:1px solid rgba(34,197,94,0.15);border-radius:9px;font-size:11.5px;color:rgba(110,231,183,0.7);">
|
| 806 |
+
● System Operational | v1.0.0
|
|
|
|
| 807 |
</div>
|
| 808 |
</div>
|
| 809 |
+
</div>
|
| 810 |
|
| 811 |
<div class="footer-bottom">
|
| 812 |
+
<span class="footer-copyright">© 2025 Nipun Kavinda · Built for Decoding Data Science Internal HR Support</span>
|
| 813 |
+
<span class="footer-dds-brand">DDS · DORA · Enterprise AI</span>
|
| 814 |
</div>
|
| 815 |
</div>
|
| 816 |
""")
|