Update app.py
Browse files
app.py
CHANGED
|
@@ -470,54 +470,6 @@ with gr.Blocks(title="🤖 Dox the Data Professional's Guide 🤖",
|
|
| 470 |
# -----------------------------
|
| 471 |
with gr.Row():
|
| 472 |
|
| 473 |
-
# Left Sidebar
|
| 474 |
-
# with gr.Column(scale=1, min_width=300, elem_classes=["sidebar-card"]):
|
| 475 |
-
# gr.Markdown(
|
| 476 |
-
# """
|
| 477 |
-
# ### 🧠 Dox is an expert in the following topics:
|
| 478 |
-
|
| 479 |
-
# - 1️⃣ **Hugging Face**
|
| 480 |
-
# - 2️⃣ **AI Agents**
|
| 481 |
-
# - 3️⃣ **SQL with AI**
|
| 482 |
-
# - 4️⃣ **Azure CLI**
|
| 483 |
-
# - 5️⃣ **Power BI**
|
| 484 |
-
# - 6️⃣ **Python**
|
| 485 |
-
# """
|
| 486 |
-
# )
|
| 487 |
-
|
| 488 |
-
# gr.HTML(
|
| 489 |
-
# """
|
| 490 |
-
# <div class="status-box">
|
| 491 |
-
# <strong>Scope:</strong> DDS HR policies only<br>
|
| 492 |
-
# <strong>Data source:</strong> Uploaded HR handbook<br>
|
| 493 |
-
# <strong>Confidential questions:</strong> Redirected to HR email
|
| 494 |
-
# </div>
|
| 495 |
-
# """
|
| 496 |
-
# )
|
| 497 |
-
|
| 498 |
-
# gr.Markdown("### 💡 Example Questions")
|
| 499 |
-
|
| 500 |
-
# example_buttons = []
|
| 501 |
-
|
| 502 |
-
# for question in example_questions:
|
| 503 |
-
# btn = gr.Button(
|
| 504 |
-
# question,
|
| 505 |
-
# variant="secondary",
|
| 506 |
-
# size="sm",
|
| 507 |
-
# elem_classes=["example-button"]
|
| 508 |
-
# )
|
| 509 |
-
# example_buttons.append(btn)
|
| 510 |
-
|
| 511 |
-
# gr.HTML(
|
| 512 |
-
# """
|
| 513 |
-
# <hr>
|
| 514 |
-
# <div class="small-note">
|
| 515 |
-
# <strong>Important:</strong><br>
|
| 516 |
-
# This chatbot does not answer non-data related questions.
|
| 517 |
-
# </div>
|
| 518 |
-
# """
|
| 519 |
-
# )
|
| 520 |
-
|
| 521 |
# Right Chat Area
|
| 522 |
with gr.Column(scale=3, elem_classes=["chat-card"]):
|
| 523 |
gr.Markdown("### 🧠 Dox is an expert in the following topics: \n1️⃣ Hugging Face | 2️⃣ AI Agents | 3️⃣ SQL with AI | 4️⃣ Azure CLI | 5️⃣ Power BI | 6️⃣ Python")
|
|
@@ -526,14 +478,14 @@ with gr.Blocks(title="🤖 Dox the Data Professional's Guide 🤖",
|
|
| 526 |
label="💬 Conversation",
|
| 527 |
elem_id="chatbot",
|
| 528 |
value=initial_chat.copy(),
|
| 529 |
-
height=
|
| 530 |
)
|
| 531 |
|
| 532 |
question = gr.Textbox(
|
| 533 |
label="🙋 Ask Dox a question:",
|
| 534 |
-
placeholder="
|
| 535 |
-
lines=
|
| 536 |
-
|
| 537 |
)
|
| 538 |
|
| 539 |
with gr.Row():
|
|
@@ -576,74 +528,6 @@ with gr.Blocks(title="🤖 Dox the Data Professional's Guide 🤖",
|
|
| 576 |
visible=False
|
| 577 |
)
|
| 578 |
pdf_link_btn = gr.Markdown("")
|
| 579 |
-
|
| 580 |
-
# # Add titles and descriptions using Markdown.
|
| 581 |
-
# gr.Markdown("# 🤖 Dox the Data Professional's Advisor 🤖")
|
| 582 |
-
# gr.Markdown("### 🧠 Dox is an expert in the following topics: \n1️⃣ Hugging Face | 2️⃣ AI Agents | 3️⃣ SQL with AI | 4️⃣ Azure CLI | 5️⃣ Power BI | 6️⃣ Python")
|
| 583 |
-
# def run_example(question_text, chat_history):
|
| 584 |
-
# return chat_ui(question_text, chat_history)
|
| 585 |
-
# # Create a main row for the layout.
|
| 586 |
-
# with gr.Row():
|
| 587 |
-
# # LEFT-SIDE COLUMN: for the chat interface.
|
| 588 |
-
# with gr.Column(scale=3):
|
| 589 |
-
# # The chatbot display window.
|
| 590 |
-
# chatbot = gr.Chatbot(label="💬 Conversation", elem_classes="chatbot", height=450)
|
| 591 |
-
# # A text area for status messages (used for PDF loading status).
|
| 592 |
-
# status_text = gr.Markdown("")
|
| 593 |
-
# # The textbox where the user types their question.
|
| 594 |
-
# question = gr.Textbox(
|
| 595 |
-
# label="🙋 Ask Dox a question:",
|
| 596 |
-
# placeholder="🤔 Type your question here...",
|
| 597 |
-
# lines=1,
|
| 598 |
-
# elem_classes="component"
|
| 599 |
-
# )
|
| 600 |
-
# # The submit button.
|
| 601 |
-
# #ask_btn = gr.Button("Submit 📤", variant="primary")
|
| 602 |
-
# with gr.Row():
|
| 603 |
-
# ask_btn = gr.Button("Submit 📤", variant="primary", elem_classes="component")
|
| 604 |
-
# clear_btn = gr.Button("🧹 Clear Chat", elem_classes="component")
|
| 605 |
-
# # A section for example questions.
|
| 606 |
-
# gr.Markdown("### 💡 Example Questions", elem_classes="component")
|
| 607 |
-
# examples = gr.Examples(
|
| 608 |
-
# examples=[
|
| 609 |
-
# "How do you log into Azure using device code authentication?",
|
| 610 |
-
# "What are the three main components of an AI agent?",
|
| 611 |
-
# "What are the \"core four\" Hugging Face libraries?",
|
| 612 |
-
# "What SQL clause is used to filter data after grouping?",
|
| 613 |
-
# "What is the latest GPT model?"
|
| 614 |
-
# ],
|
| 615 |
-
# inputs=question,
|
| 616 |
-
# outputs=[chatbot, question],
|
| 617 |
-
# fn=run_example,
|
| 618 |
-
# cache_examples=False
|
| 619 |
-
# )
|
| 620 |
-
# # 👍👎 Feedback buttons
|
| 621 |
-
# with gr.Row():
|
| 622 |
-
# thumbs_up = gr.Button("👍 Helpful", elem_classes="component")
|
| 623 |
-
# thumbs_down = gr.Button("👎 Not Helpful", elem_classes="component")
|
| 624 |
-
|
| 625 |
-
# # Hidden feedback box (only appears on 👎)
|
| 626 |
-
# feedback_box = gr.Textbox(
|
| 627 |
-
# placeholder="💬 Optional: tell us what went wrong...",
|
| 628 |
-
# visible=False
|
| 629 |
-
# )
|
| 630 |
-
|
| 631 |
-
# submit_feedback_btn = gr.Button("📝 Submit Feedback", visible=False, elem_classes="component")
|
| 632 |
-
# feedback_status = gr.Markdown("", elem_classes="component")
|
| 633 |
-
# # RIGHT-SIDE COLUMN: for the PDF preview.
|
| 634 |
-
# with gr.Column(scale=3):
|
| 635 |
-
# gr.Markdown("### 📄 Referenced PDF Document (🌐 Empty for Web Results)", elem_classes="component")
|
| 636 |
-
# #gr.Markdown(" 🌐 Empty by default", elem_classes="component")
|
| 637 |
-
# # A hidden state to store the PDF link found in the agent's response.
|
| 638 |
-
# link_state = gr.State()
|
| 639 |
-
# # A markdown component to show PDF loading status.
|
| 640 |
-
# pdf_status = gr.Markdown(visible=False, elem_classes="component")
|
| 641 |
-
# # An image component to display the PDF preview.
|
| 642 |
-
# output_image = gr.Image(
|
| 643 |
-
# label="⬇️ Cheat Sheet Preview",
|
| 644 |
-
# visible=False
|
| 645 |
-
# )
|
| 646 |
-
# pdf_link_btn = gr.Markdown("")
|
| 647 |
|
| 648 |
# Defines the main chat logic as a generator function for streaming output.
|
| 649 |
def chat_ui(user_message, chat_history):
|
|
@@ -797,8 +681,8 @@ with gr.Blocks(title="🤖 Dox the Data Professional's Guide 🤖",
|
|
| 797 |
if __name__ == "__main__":
|
| 798 |
demo.launch(
|
| 799 |
theme=gr.themes.Ocean(
|
| 800 |
-
primary_hue="indigo",
|
| 801 |
-
neutral_hue="slate"
|
| 802 |
),
|
| 803 |
css=custom_css
|
| 804 |
)
|
|
|
|
| 470 |
# -----------------------------
|
| 471 |
with gr.Row():
|
| 472 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 473 |
# Right Chat Area
|
| 474 |
with gr.Column(scale=3, elem_classes=["chat-card"]):
|
| 475 |
gr.Markdown("### 🧠 Dox is an expert in the following topics: \n1️⃣ Hugging Face | 2️⃣ AI Agents | 3️⃣ SQL with AI | 4️⃣ Azure CLI | 5️⃣ Power BI | 6️⃣ Python")
|
|
|
|
| 478 |
label="💬 Conversation",
|
| 479 |
elem_id="chatbot",
|
| 480 |
value=initial_chat.copy(),
|
| 481 |
+
height=450
|
| 482 |
)
|
| 483 |
|
| 484 |
question = gr.Textbox(
|
| 485 |
label="🙋 Ask Dox a question:",
|
| 486 |
+
placeholder="🤔 Type your question here...",
|
| 487 |
+
lines=1,
|
| 488 |
+
elem_classes="question_box"
|
| 489 |
)
|
| 490 |
|
| 491 |
with gr.Row():
|
|
|
|
| 528 |
visible=False
|
| 529 |
)
|
| 530 |
pdf_link_btn = gr.Markdown("")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 531 |
|
| 532 |
# Defines the main chat logic as a generator function for streaming output.
|
| 533 |
def chat_ui(user_message, chat_history):
|
|
|
|
| 681 |
if __name__ == "__main__":
|
| 682 |
demo.launch(
|
| 683 |
theme=gr.themes.Ocean(
|
| 684 |
+
# primary_hue="indigo",
|
| 685 |
+
# neutral_hue="slate"
|
| 686 |
),
|
| 687 |
css=custom_css
|
| 688 |
)
|