UlrickBL commited on
Commit
3968f3b
·
verified ·
1 Parent(s): a0916c3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -9
app.py CHANGED
@@ -13,7 +13,6 @@ def filter_table(query):
13
  df['Note'].str.contains(query, case=False, na=False)
14
  ]
15
 
16
- # Styled HTML with full-width scrollable table
17
  style = """
18
  <style>
19
  .scroll-container {
@@ -59,19 +58,16 @@ def filter_table(query):
59
  html_table += "</table></div>"
60
  return html_table
61
 
62
- # Gradio Blocks layout for better positioning
63
  with gr.Blocks(title="Reading Notes Viewer") as demo:
64
  gr.Markdown("### Search and browse your reading notes")
65
 
66
- query = gr.Textbox(label="Search", placeholder="Type a keyword...")
67
- output = gr.HTML()
68
 
69
- query.change(fn=filter_table, inputs=query, outputs=output)
70
-
71
- # Show full table by default
72
- output.style(full_width=True)
73
- output.update(value=filter_table(""))
74
 
75
  demo.launch()
76
 
77
 
 
 
13
  df['Note'].str.contains(query, case=False, na=False)
14
  ]
15
 
 
16
  style = """
17
  <style>
18
  .scroll-container {
 
58
  html_table += "</table></div>"
59
  return html_table
60
 
61
+ # Gradio app using Blocks layout
62
  with gr.Blocks(title="Reading Notes Viewer") as demo:
63
  gr.Markdown("### Search and browse your reading notes")
64
 
65
+ search_box = gr.Textbox(label="Search", placeholder="Type a keyword...")
66
+ table_output = gr.HTML(value=filter_table(""))
67
 
68
+ search_box.change(fn=filter_table, inputs=search_box, outputs=table_output)
 
 
 
 
69
 
70
  demo.launch()
71
 
72
 
73
+