siddhartharya commited on
Commit
36d73c0
Β·
verified Β·
1 Parent(s): 211e5fb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -1,5 +1,4 @@
1
  # app.py
2
-
3
  import gradio as gr
4
  from bs4 import BeautifulSoup
5
  import requests
@@ -343,6 +342,7 @@ def process_uploaded_file(file, state_bookmarks):
343
  def delete_selected_bookmarks(selected_indices, state_bookmarks):
344
  if not selected_indices:
345
  return "⚠️ No bookmarks selected.", gr.update(choices=[]), ""
 
346
  bookmarks = state_bookmarks[0]
347
  indices = []
348
  for s in selected_indices:
@@ -514,6 +514,10 @@ SmartMarks is divided into three main sections:
514
  Navigate through the tabs to explore each feature in detail.
515
  """)
516
 
 
 
 
 
517
  # Upload and Process Bookmarks Tab
518
  with gr.Tab("Upload and Process Bookmarks"):
519
  gr.Markdown("""
@@ -541,7 +545,7 @@ Navigate through the tabs to explore each feature in detail.
541
  process_button.click(
542
  process_uploaded_file,
543
  inputs=[upload, state_bookmarks],
544
- outputs=[output_text, bookmark_display, "bookmark_selector", "bookmark_display_manage"] # Added outputs for Manage Bookmarks
545
  )
546
 
547
  # Chat with Bookmarks Tab
@@ -616,14 +620,12 @@ Navigate through the tabs to explore each feature in detail.
616
  """)
617
 
618
  manage_output = gr.Textbox(label="πŸ”„ Manage Output", interactive=False)
619
- bookmark_selector = gr.CheckboxGroup(label="βœ… Select Bookmarks", choices=[])
620
  new_category_input = gr.Dropdown(label="πŸ†• New Category", choices=CATEGORIES, value="Uncategorized")
621
  with gr.Row():
622
  delete_button = gr.Button("πŸ—‘οΈ Delete Selected Bookmarks")
623
  edit_category_button = gr.Button("✏️ Edit Category of Selected Bookmarks")
624
  export_button = gr.Button("πŸ’Ύ Export Bookmarks")
625
  download_link = gr.HTML(label="πŸ“₯ Download Exported Bookmarks")
626
- bookmark_display_manage = gr.HTML(label="πŸ“„ Manage Bookmarks Display")
627
  refresh_button = gr.Button("πŸ”„ Refresh Bookmarks")
628
 
629
  # Define button actions
 
1
  # app.py
 
2
  import gradio as gr
3
  from bs4 import BeautifulSoup
4
  import requests
 
342
  def delete_selected_bookmarks(selected_indices, state_bookmarks):
343
  if not selected_indices:
344
  return "⚠️ No bookmarks selected.", gr.update(choices=[]), ""
345
+
346
  bookmarks = state_bookmarks[0]
347
  indices = []
348
  for s in selected_indices:
 
514
  Navigate through the tabs to explore each feature in detail.
515
  """)
516
 
517
+ # Define Manage Bookmarks components outside the tab for global access
518
+ bookmark_selector = gr.CheckboxGroup(label="βœ… Select Bookmarks", choices=[])
519
+ bookmark_display_manage = gr.HTML(label="πŸ“„ Manage Bookmarks Display")
520
+
521
  # Upload and Process Bookmarks Tab
522
  with gr.Tab("Upload and Process Bookmarks"):
523
  gr.Markdown("""
 
545
  process_button.click(
546
  process_uploaded_file,
547
  inputs=[upload, state_bookmarks],
548
+ outputs=[output_text, bookmark_display, bookmark_selector, bookmark_display_manage]
549
  )
550
 
551
  # Chat with Bookmarks Tab
 
620
  """)
621
 
622
  manage_output = gr.Textbox(label="πŸ”„ Manage Output", interactive=False)
 
623
  new_category_input = gr.Dropdown(label="πŸ†• New Category", choices=CATEGORIES, value="Uncategorized")
624
  with gr.Row():
625
  delete_button = gr.Button("πŸ—‘οΈ Delete Selected Bookmarks")
626
  edit_category_button = gr.Button("✏️ Edit Category of Selected Bookmarks")
627
  export_button = gr.Button("πŸ’Ύ Export Bookmarks")
628
  download_link = gr.HTML(label="πŸ“₯ Download Exported Bookmarks")
 
629
  refresh_button = gr.Button("πŸ”„ Refresh Bookmarks")
630
 
631
  # Define button actions