Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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
|
| 63 |
with gr.Blocks(title="Reading Notes Viewer") as demo:
|
| 64 |
gr.Markdown("### Search and browse your reading notes")
|
| 65 |
|
| 66 |
-
|
| 67 |
-
|
| 68 |
|
| 69 |
-
|
| 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 |
+
|