Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import pandas as pd
|
| 3 |
+
|
| 4 |
+
# Load the exported Notion CSV file
|
| 5 |
+
df = pd.read_csv("paper_reading.csv") # Adjust to your actual column names if needed
|
| 6 |
+
|
| 7 |
+
def search_papers(query):
|
| 8 |
+
# Filter the dataframe based on the search query
|
| 9 |
+
filtered = df[df['Paper name'].str.contains(query, case=False, na=False) |
|
| 10 |
+
df['Note'].str.contains(query, case=False, na=False)]
|
| 11 |
+
|
| 12 |
+
# Define a futuristic CSS style and wrap the results in a table
|
| 13 |
+
style = """
|
| 14 |
+
<style>
|
| 15 |
+
.futuristic-table {
|
| 16 |
+
width: 100%;
|
| 17 |
+
border-collapse: collapse;
|
| 18 |
+
font-family: 'Segoe UI', sans-serif;
|
| 19 |
+
color: #00ffe7;
|
| 20 |
+
background-color: #0d1117;
|
| 21 |
+
border: 1px solid #30363d;
|
| 22 |
+
border-radius: 10px;
|
| 23 |
+
overflow: hidden;
|
| 24 |
+
box-shadow: 0 0 20px #00ffe7aa;
|
| 25 |
+
}
|
| 26 |
+
.futuristic-table th {
|
| 27 |
+
background-color: #161b22;
|
| 28 |
+
color: #58a6ff;
|
| 29 |
+
padding: 10px;
|
| 30 |
+
border-bottom: 2px solid #30363d;
|
| 31 |
+
}
|
| 32 |
+
.futuristic-table td {
|
| 33 |
+
padding: 12px;
|
| 34 |
+
border-bottom: 1px solid #30363d;
|
| 35 |
+
}
|
| 36 |
+
.futuristic-table tr:hover {
|
| 37 |
+
background-color: #1c2128;
|
| 38 |
+
}
|
| 39 |
+
</style>
|
| 40 |
+
"""
|
| 41 |
+
|
| 42 |
+
html_table = f"{style}<table class='futuristic-table'>"
|
| 43 |
+
html_table += "<tr><th>π Paper</th><th>π Note</th><th>β
Status</th></tr>"
|
| 44 |
+
|
| 45 |
+
for _, row in filtered.iterrows():
|
| 46 |
+
html_table += f"<tr><td>{row['Paper name']}</td><td>{row['Note']}</td><td>{row['Status']}</td></tr>"
|
| 47 |
+
|
| 48 |
+
html_table += "</table>"
|
| 49 |
+
return html_table
|
| 50 |
+
|
| 51 |
+
# Gradio UI
|
| 52 |
+
demo = gr.Interface(
|
| 53 |
+
fn=search_papers,
|
| 54 |
+
inputs=gr.Textbox(label="π Search Your Papers"),
|
| 55 |
+
outputs=gr.HTML(label="Results"),
|
| 56 |
+
title="π Futuristic Paper Notes Explorer",
|
| 57 |
+
description="Search your Notion-exported reading notes in style."
|
| 58 |
+
)
|
| 59 |
+
|
| 60 |
+
demo.launch()
|