Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -722,12 +722,6 @@ def build_app():
|
|
722 |
# Initialize state
|
723 |
state_bookmarks = gr.State([])
|
724 |
|
725 |
-
# Define 'bookmark_selector' first
|
726 |
-
bookmark_selector = gr.CheckboxGroup(
|
727 |
-
label="β
Select Bookmarks",
|
728 |
-
choices=[]
|
729 |
-
)
|
730 |
-
|
731 |
# General Overview
|
732 |
gr.Markdown("""
|
733 |
# π SmartMarks - AI Browser Bookmarks Manager
|
@@ -747,7 +741,7 @@ SmartMarks is divided into three main sections:
|
|
747 |
Navigate through the tabs to explore each feature in detail.
|
748 |
""")
|
749 |
|
750 |
-
#
|
751 |
with gr.Tab("Upload and Process Bookmarks"):
|
752 |
gr.Markdown("""
|
753 |
## π **Upload and Process Bookmarks**
|
@@ -765,7 +759,6 @@ Navigate through the tabs to explore each feature in detail.
|
|
765 |
3. **View Processed Bookmarks:**
|
766 |
- Once processing is complete, your bookmarks will be displayed in an organized and visually appealing format below.
|
767 |
""")
|
768 |
-
|
769 |
upload = gr.File(label="π Upload Bookmarks HTML File", type='binary')
|
770 |
process_button = gr.Button("βοΈ Process Bookmarks")
|
771 |
output_text = gr.Textbox(label="β
Output", interactive=False)
|
@@ -774,10 +767,9 @@ Navigate through the tabs to explore each feature in detail.
|
|
774 |
process_button.click(
|
775 |
process_uploaded_file,
|
776 |
inputs=[upload, state_bookmarks],
|
777 |
-
outputs=[output_text, bookmark_display, state_bookmarks, bookmark_display, bookmark_selector]
|
778 |
)
|
779 |
|
780 |
-
# Chat with Bookmarks Tab
|
781 |
with gr.Tab("Chat with Bookmarks"):
|
782 |
gr.Markdown("""
|
783 |
## π¬ **Chat with Bookmarks**
|
@@ -796,7 +788,6 @@ Navigate through the tabs to explore each feature in detail.
|
|
796 |
4. **View Chat History:**
|
797 |
- All your queries and the corresponding AI responses are displayed in the chat history for your reference.
|
798 |
""")
|
799 |
-
|
800 |
chatbot = gr.Chatbot(label="π¬ Chat with SmartMarks", type='messages')
|
801 |
user_input = gr.Textbox(
|
802 |
label="βοΈ Ask about your bookmarks",
|
@@ -810,7 +801,6 @@ Navigate through the tabs to explore each feature in detail.
|
|
810 |
outputs=chatbot
|
811 |
)
|
812 |
|
813 |
-
# Manage Bookmarks Tab
|
814 |
with gr.Tab("Manage Bookmarks"):
|
815 |
gr.Markdown("""
|
816 |
## π οΈ **Manage Bookmarks**
|
@@ -838,9 +828,7 @@ Navigate through the tabs to explore each feature in detail.
|
|
838 |
6. **Refresh Bookmarks:**
|
839 |
- Click the **"π Refresh Bookmarks"** button to ensure the latest state is reflected in the display.
|
840 |
""")
|
841 |
-
|
842 |
manage_output = gr.Textbox(label="π Status", interactive=False)
|
843 |
-
# 'bookmark_selector' is already defined above
|
844 |
new_category = gr.Dropdown(
|
845 |
label="π New Category",
|
846 |
choices=CATEGORIES,
|
@@ -848,6 +836,13 @@ Navigate through the tabs to explore each feature in detail.
|
|
848 |
)
|
849 |
bookmark_display_manage = gr.HTML(label="π Bookmarks")
|
850 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
851 |
with gr.Row():
|
852 |
delete_button = gr.Button("ποΈ Delete Selected")
|
853 |
edit_category_button = gr.Button("βοΈ Edit Category")
|
|
|
722 |
# Initialize state
|
723 |
state_bookmarks = gr.State([])
|
724 |
|
|
|
|
|
|
|
|
|
|
|
|
|
725 |
# General Overview
|
726 |
gr.Markdown("""
|
727 |
# π SmartMarks - AI Browser Bookmarks Manager
|
|
|
741 |
Navigate through the tabs to explore each feature in detail.
|
742 |
""")
|
743 |
|
744 |
+
# Define tabs
|
745 |
with gr.Tab("Upload and Process Bookmarks"):
|
746 |
gr.Markdown("""
|
747 |
## π **Upload and Process Bookmarks**
|
|
|
759 |
3. **View Processed Bookmarks:**
|
760 |
- Once processing is complete, your bookmarks will be displayed in an organized and visually appealing format below.
|
761 |
""")
|
|
|
762 |
upload = gr.File(label="π Upload Bookmarks HTML File", type='binary')
|
763 |
process_button = gr.Button("βοΈ Process Bookmarks")
|
764 |
output_text = gr.Textbox(label="β
Output", interactive=False)
|
|
|
767 |
process_button.click(
|
768 |
process_uploaded_file,
|
769 |
inputs=[upload, state_bookmarks],
|
770 |
+
outputs=[output_text, bookmark_display, state_bookmarks, bookmark_display, "bookmark_selector"]
|
771 |
)
|
772 |
|
|
|
773 |
with gr.Tab("Chat with Bookmarks"):
|
774 |
gr.Markdown("""
|
775 |
## π¬ **Chat with Bookmarks**
|
|
|
788 |
4. **View Chat History:**
|
789 |
- All your queries and the corresponding AI responses are displayed in the chat history for your reference.
|
790 |
""")
|
|
|
791 |
chatbot = gr.Chatbot(label="π¬ Chat with SmartMarks", type='messages')
|
792 |
user_input = gr.Textbox(
|
793 |
label="βοΈ Ask about your bookmarks",
|
|
|
801 |
outputs=chatbot
|
802 |
)
|
803 |
|
|
|
804 |
with gr.Tab("Manage Bookmarks"):
|
805 |
gr.Markdown("""
|
806 |
## π οΈ **Manage Bookmarks**
|
|
|
828 |
6. **Refresh Bookmarks:**
|
829 |
- Click the **"π Refresh Bookmarks"** button to ensure the latest state is reflected in the display.
|
830 |
""")
|
|
|
831 |
manage_output = gr.Textbox(label="π Status", interactive=False)
|
|
|
832 |
new_category = gr.Dropdown(
|
833 |
label="π New Category",
|
834 |
choices=CATEGORIES,
|
|
|
836 |
)
|
837 |
bookmark_display_manage = gr.HTML(label="π Bookmarks")
|
838 |
|
839 |
+
with gr.Row():
|
840 |
+
# Define 'bookmark_selector' inside the tab
|
841 |
+
bookmark_selector = gr.CheckboxGroup(
|
842 |
+
label="β
Select Bookmarks",
|
843 |
+
choices=[]
|
844 |
+
)
|
845 |
+
|
846 |
with gr.Row():
|
847 |
delete_button = gr.Button("ποΈ Delete Selected")
|
848 |
edit_category_button = gr.Button("βοΈ Edit Category")
|