siddhartharya commited on
Commit
d0c6279
β€’
1 Parent(s): 83759f1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +51 -92
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
- # πŸ“š SmartMarks - AI Browser Bookmarks Manager
645
 
646
- 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.
647
 
648
- ---
649
 
650
- ## πŸš€ **How to Use SmartMarks**
651
 
652
- SmartMarks is divided into three main sections:
653
 
654
- 1. **πŸ“‚ Upload and Process Bookmarks:** Import your existing bookmarks and let SmartMarks analyze and categorize them for you.
655
- 2. **πŸ’¬ Chat with Bookmarks:** Interact with your bookmarks using natural language queries to find relevant links effortlessly.
656
- 3. **πŸ› οΈ Manage Bookmarks:** View, edit, delete, and export your bookmarks with ease.
657
 
658
- Navigate through the tabs to explore each feature in detail.
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
- ## πŸ“‚ **Upload and Process Bookmarks**
669
 
670
- ### πŸ“ **Steps to Upload and Process:**
671
 
672
- 1. **πŸ”½ Upload Bookmarks File:**
673
- - Click on the **"πŸ“ Upload Bookmarks HTML File"** button.
674
- - Select your browser's exported bookmarks HTML file from your device.
675
 
676
- 2. **βš™οΈ Process Bookmarks:**
677
- - After uploading, click on the **"βš™οΈ Process Bookmarks"** button.
678
- - SmartMarks will parse your bookmarks, fetch additional information, generate summaries, and categorize each link based on predefined categories.
679
 
680
- 3. **πŸ“„ View Processed Bookmarks:**
681
- - Once processing is complete, your bookmarks will be displayed in an organized and visually appealing format below.
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
- ## πŸ’¬ **Chat with Bookmarks**
699
 
700
- ### πŸ€– **How to Interact:**
701
 
702
- 1. **✍️ Enter Your Query:**
703
- - 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?"
704
 
705
- 2. **πŸ“¨ Submit Your Query:**
706
- - Click the **"πŸ“¨ Send"** button to submit your query.
707
 
708
- 3. **πŸ“ˆ Receive AI-Driven Responses:**
709
- - SmartMarks will analyze your query and provide relevant bookmarks that match your request, making it easier to find specific links without manual searching.
710
 
711
- 4. **πŸ—‚οΈ View Chat History:**
712
- - All your queries and the corresponding AI responses are displayed in the chat history for your reference.
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
- ## πŸ› οΈ **Manage Bookmarks**
744
 
745
- ### πŸ—‚οΈ **Features:**
746
 
747
- 1. **πŸ‘οΈ View Bookmarks:**
748
- - All your processed bookmarks are displayed here with their respective categories and summaries.
749
 
750
- 2. **βœ… Select Bookmarks:**
751
- - Use the checkboxes next to each bookmark to select one, multiple, or all bookmarks you wish to manage.
752
 
753
- 3. **πŸ—‘οΈ Delete Selected Bookmarks:**
754
- - After selecting the desired bookmarks, click the **"πŸ—‘οΈ Delete Selected Bookmarks"** button to remove them from your list.
755
 
756
- 4. **✏️ Edit Categories:**
757
- - Select the bookmarks you want to re-categorize.
758
- - Choose a new category from the dropdown menu labeled **"πŸ†• New Category"**.
759
- - Click the **"✏️ Edit Category of Selected Bookmarks"** button to update their categories.
760
 
761
- 5. **πŸ’Ύ Export Bookmarks:**
762
- - Click the **"πŸ’Ύ Export Bookmarks"** button to download your updated bookmarks as an HTML file.
763
- - This file can be uploaded back to your browser to reflect the changes made within SmartMarks.
764
 
765
- 6. **πŸ”„ Refresh Bookmarks:**
766
- - Click the **"πŸ”„ Refresh Bookmarks"** button to ensure the latest state is reflected in the display.
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")