Spaces:
Sleeping
Sleeping
siddhartharya
commited on
Commit
β’
d0c6279
1
Parent(s):
83759f1
Update app.py
Browse files
app.py
CHANGED
@@ -593,70 +593,29 @@ Please provide a concise summary of the most relevant bookmarks that match the u
|
|
593 |
def build_app():
|
594 |
try:
|
595 |
logger.info("Building Gradio app")
|
596 |
-
with gr.Blocks(css=""
|
597 |
-
.card {
|
598 |
-
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2);
|
599 |
-
transition: 0.3s;
|
600 |
-
}
|
601 |
-
.card:hover {
|
602 |
-
box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2);
|
603 |
-
}
|
604 |
-
|
605 |
-
/* Dynamic Theme Styling */
|
606 |
-
@media (prefers-color-scheme: dark) {
|
607 |
-
body {
|
608 |
-
color: white;
|
609 |
-
background-color: #121212;
|
610 |
-
}
|
611 |
-
.card {
|
612 |
-
background-color: #1e1e1e;
|
613 |
-
}
|
614 |
-
a {
|
615 |
-
color: #bb86fc;
|
616 |
-
}
|
617 |
-
h1, h2, h3, p, strong {
|
618 |
-
color: inherit;
|
619 |
-
}
|
620 |
-
}
|
621 |
-
|
622 |
-
@media (prefers-color-scheme: light) {
|
623 |
-
body {
|
624 |
-
color: black;
|
625 |
-
background-color: white;
|
626 |
-
}
|
627 |
-
.card {
|
628 |
-
background-color: #fff;
|
629 |
-
}
|
630 |
-
a {
|
631 |
-
color: #1a0dab;
|
632 |
-
}
|
633 |
-
h1, h2, h3, p, strong {
|
634 |
-
color: inherit;
|
635 |
-
}
|
636 |
-
}
|
637 |
-
""") as demo:
|
638 |
# Shared states
|
639 |
state_bookmarks = gr.State([])
|
640 |
chat_history = gr.State([])
|
641 |
|
642 |
# General Overview
|
643 |
gr.Markdown("""
|
644 |
-
|
645 |
|
646 |
-
|
647 |
|
648 |
-
|
649 |
|
650 |
-
|
651 |
|
652 |
-
|
653 |
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
|
658 |
-
|
659 |
-
|
660 |
|
661 |
# Define Manage Bookmarks components outside the tab for global access
|
662 |
bookmark_selector = gr.CheckboxGroup(label="β
Select Bookmarks", choices=[])
|
@@ -665,21 +624,21 @@ def build_app():
|
|
665 |
# Upload and Process Bookmarks Tab
|
666 |
with gr.Tab("Upload and Process Bookmarks"):
|
667 |
gr.Markdown("""
|
668 |
-
|
669 |
|
670 |
-
|
671 |
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
|
684 |
upload = gr.File(label="π Upload Bookmarks HTML File", type='binary')
|
685 |
process_button = gr.Button("βοΈ Process Bookmarks")
|
@@ -695,22 +654,22 @@ def build_app():
|
|
695 |
# Chat with Bookmarks Tab
|
696 |
with gr.Tab("Chat with Bookmarks"):
|
697 |
gr.Markdown("""
|
698 |
-
|
699 |
|
700 |
-
|
701 |
|
702 |
-
|
703 |
-
|
704 |
|
705 |
-
|
706 |
-
|
707 |
|
708 |
-
|
709 |
-
|
710 |
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
|
715 |
with gr.Row():
|
716 |
chat_history_display = gr.Chatbot(label="π¨οΈ Chat History")
|
@@ -740,31 +699,31 @@ def build_app():
|
|
740 |
# Manage Bookmarks Tab
|
741 |
with gr.Tab("Manage Bookmarks"):
|
742 |
gr.Markdown("""
|
743 |
-
|
744 |
|
745 |
-
|
746 |
|
747 |
-
|
748 |
-
|
749 |
|
750 |
-
|
751 |
-
|
752 |
|
753 |
-
|
754 |
-
|
755 |
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
|
769 |
manage_output = gr.Textbox(label="π Manage Output", interactive=False)
|
770 |
new_category_input = gr.Dropdown(label="π New Category", choices=CATEGORIES, value="Uncategorized")
|
|
|
593 |
def build_app():
|
594 |
try:
|
595 |
logger.info("Building Gradio app")
|
596 |
+
with gr.Blocks(css="app.css") as demo: # Load external CSS file
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
597 |
# Shared states
|
598 |
state_bookmarks = gr.State([])
|
599 |
chat_history = gr.State([])
|
600 |
|
601 |
# General Overview
|
602 |
gr.Markdown("""
|
603 |
+
# π SmartMarks - AI Browser Bookmarks Manager
|
604 |
|
605 |
+
Welcome to **SmartMarks**, your intelligent assistant for managing browser bookmarks. SmartMarks leverages AI to help you organize, search, and interact with your bookmarks seamlessly. Whether you're looking to categorize your links, retrieve information quickly, or maintain an updated list, SmartMarks has you covered.
|
606 |
|
607 |
+
---
|
608 |
|
609 |
+
## π **How to Use SmartMarks**
|
610 |
|
611 |
+
SmartMarks is divided into three main sections:
|
612 |
|
613 |
+
1. **π Upload and Process Bookmarks:** Import your existing bookmarks and let SmartMarks analyze and categorize them for you.
|
614 |
+
2. **π¬ Chat with Bookmarks:** Interact with your bookmarks using natural language queries to find relevant links effortlessly.
|
615 |
+
3. **π οΈ Manage Bookmarks:** View, edit, delete, and export your bookmarks with ease.
|
616 |
|
617 |
+
Navigate through the tabs to explore each feature in detail.
|
618 |
+
""")
|
619 |
|
620 |
# Define Manage Bookmarks components outside the tab for global access
|
621 |
bookmark_selector = gr.CheckboxGroup(label="β
Select Bookmarks", choices=[])
|
|
|
624 |
# Upload and Process Bookmarks Tab
|
625 |
with gr.Tab("Upload and Process Bookmarks"):
|
626 |
gr.Markdown("""
|
627 |
+
## π **Upload and Process Bookmarks**
|
628 |
|
629 |
+
### π **Steps to Upload and Process:**
|
630 |
|
631 |
+
1. **π½ Upload Bookmarks File:**
|
632 |
+
- Click on the **"π Upload Bookmarks HTML File"** button.
|
633 |
+
- Select your browser's exported bookmarks HTML file from your device.
|
634 |
|
635 |
+
2. **βοΈ Process Bookmarks:**
|
636 |
+
- After uploading, click on the **"βοΈ Process Bookmarks"** button.
|
637 |
+
- SmartMarks will parse your bookmarks, fetch additional information, generate summaries, and categorize each link based on predefined categories.
|
638 |
|
639 |
+
3. **π View Processed Bookmarks:**
|
640 |
+
- Once processing is complete, your bookmarks will be displayed in an organized and visually appealing format below.
|
641 |
+
""")
|
642 |
|
643 |
upload = gr.File(label="π Upload Bookmarks HTML File", type='binary')
|
644 |
process_button = gr.Button("βοΈ Process Bookmarks")
|
|
|
654 |
# Chat with Bookmarks Tab
|
655 |
with gr.Tab("Chat with Bookmarks"):
|
656 |
gr.Markdown("""
|
657 |
+
## π¬ **Chat with Bookmarks**
|
658 |
|
659 |
+
### π€ **How to Interact:**
|
660 |
|
661 |
+
1. **βοΈ Enter Your Query:**
|
662 |
+
- In the **"βοΈ Ask about your bookmarks"** textbox, type your question or keyword related to your bookmarks. For example, "Do I have any bookmarks about GenerativeAI?"
|
663 |
|
664 |
+
2. **π¨ Submit Your Query:**
|
665 |
+
- Click the **"π¨ Send"** button to submit your query.
|
666 |
|
667 |
+
3. **π Receive AI-Driven Responses:**
|
668 |
+
- SmartMarks will analyze your query and provide relevant bookmarks that match your request, making it easier to find specific links without manual searching.
|
669 |
|
670 |
+
4. **ποΈ View Chat History:**
|
671 |
+
- All your queries and the corresponding AI responses are displayed in the chat history for your reference.
|
672 |
+
""")
|
673 |
|
674 |
with gr.Row():
|
675 |
chat_history_display = gr.Chatbot(label="π¨οΈ Chat History")
|
|
|
699 |
# Manage Bookmarks Tab
|
700 |
with gr.Tab("Manage Bookmarks"):
|
701 |
gr.Markdown("""
|
702 |
+
## π οΈ **Manage Bookmarks**
|
703 |
|
704 |
+
### ποΈ **Features:**
|
705 |
|
706 |
+
1. **ποΈ View Bookmarks:**
|
707 |
+
- All your processed bookmarks are displayed here with their respective categories and summaries.
|
708 |
|
709 |
+
2. **β
Select Bookmarks:**
|
710 |
+
- Use the checkboxes next to each bookmark to select one, multiple, or all bookmarks you wish to manage.
|
711 |
|
712 |
+
3. **ποΈ Delete Selected Bookmarks:**
|
713 |
+
- After selecting the desired bookmarks, click the **"ποΈ Delete Selected Bookmarks"** button to remove them from your list.
|
714 |
|
715 |
+
4. **βοΈ Edit Categories:**
|
716 |
+
- Select the bookmarks you want to re-categorize.
|
717 |
+
- Choose a new category from the dropdown menu labeled **"π New Category"**.
|
718 |
+
- Click the **"βοΈ Edit Category of Selected Bookmarks"** button to update their categories.
|
719 |
|
720 |
+
5. **πΎ Export Bookmarks:**
|
721 |
+
- Click the **"πΎ Export Bookmarks"** button to download your updated bookmarks as an HTML file.
|
722 |
+
- This file can be uploaded back to your browser to reflect the changes made within SmartMarks.
|
723 |
|
724 |
+
6. **π Refresh Bookmarks:**
|
725 |
+
- Click the **"π Refresh Bookmarks"** button to ensure the latest state is reflected in the display.
|
726 |
+
""")
|
727 |
|
728 |
manage_output = gr.Textbox(label="π Manage Output", interactive=False)
|
729 |
new_category_input = gr.Dropdown(label="π New Category", choices=CATEGORIES, value="Uncategorized")
|