Spaces:
Runtime error
Runtime error
Commit
·
b31f2bf
1
Parent(s):
7b45b46
new
Browse files
app.py
CHANGED
|
@@ -8,7 +8,7 @@ todo_df = pd.DataFrame(columns=TODO_COLUMNS)
|
|
| 8 |
# Function to add a new task
|
| 9 |
def add_task(task, priority, status):
|
| 10 |
global todo_df
|
| 11 |
-
if task: # Ensure task is not empty
|
| 12 |
new_task = pd.DataFrame([[task, priority, status]], columns=TODO_COLUMNS)
|
| 13 |
todo_df = pd.concat([todo_df, new_task], ignore_index=True)
|
| 14 |
return todo_df
|
|
@@ -24,34 +24,45 @@ def delete_task(index):
|
|
| 24 |
def get_tasks():
|
| 25 |
return todo_df
|
| 26 |
|
| 27 |
-
# Initialize Gradio app with dark
|
| 28 |
with gr.Blocks() as demo:
|
| 29 |
-
gr.Markdown(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
|
| 31 |
task_table = gr.Dataframe(
|
| 32 |
value=get_tasks(),
|
| 33 |
headers=TODO_COLUMNS,
|
| 34 |
interactive=False,
|
| 35 |
label="Current Tasks",
|
| 36 |
-
|
| 37 |
)
|
| 38 |
|
| 39 |
# Add Task Section
|
| 40 |
with gr.Row():
|
| 41 |
-
task_input = gr.Textbox(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
priority_input = gr.Dropdown(
|
| 43 |
choices=["Low", "Medium", "High"],
|
| 44 |
label="Priority",
|
| 45 |
value="Medium",
|
| 46 |
-
|
| 47 |
)
|
| 48 |
status_input = gr.Dropdown(
|
| 49 |
choices=["Not Started", "In Progress", "Completed"],
|
| 50 |
label="Status",
|
| 51 |
value="Not Started",
|
| 52 |
-
|
| 53 |
)
|
| 54 |
-
add_button = gr.Button("Add Task",
|
| 55 |
|
| 56 |
add_button.click(
|
| 57 |
fn=add_task,
|
|
@@ -60,8 +71,8 @@ with gr.Blocks() as demo:
|
|
| 60 |
)
|
| 61 |
|
| 62 |
# Delete Task Section
|
| 63 |
-
delete_index = gr.Number(label="Task Index to Delete", value=0,
|
| 64 |
-
delete_button = gr.Button("Delete Task",
|
| 65 |
|
| 66 |
delete_button.click(
|
| 67 |
fn=delete_task,
|
|
@@ -69,43 +80,51 @@ with gr.Blocks() as demo:
|
|
| 69 |
outputs=task_table
|
| 70 |
)
|
| 71 |
|
| 72 |
-
# Custom CSS for
|
| 73 |
custom_css = """
|
| 74 |
body {
|
| 75 |
-
background-color: #
|
| 76 |
-
color: #
|
|
|
|
| 77 |
}
|
| 78 |
-
|
| 79 |
color: #FFA500;
|
| 80 |
-
|
| 81 |
-
font-weight: bold;
|
| 82 |
}
|
| 83 |
-
|
| 84 |
-
background-color: #
|
| 85 |
-
color: #
|
| 86 |
border: 1px solid #FFA500;
|
|
|
|
| 87 |
}
|
| 88 |
-
|
| 89 |
-
background-color: #
|
| 90 |
-
color: #
|
| 91 |
border: 1px solid #FFA500;
|
|
|
|
|
|
|
| 92 |
}
|
| 93 |
-
|
| 94 |
-
background-color: #
|
| 95 |
-
color: #
|
| 96 |
border: 1px solid #FFA500;
|
|
|
|
|
|
|
| 97 |
}
|
| 98 |
-
|
| 99 |
background-color: #FFA500;
|
| 100 |
-
color: #
|
| 101 |
border: none;
|
| 102 |
-
|
| 103 |
-
|
| 104 |
font-weight: bold;
|
|
|
|
|
|
|
| 105 |
}
|
| 106 |
-
|
| 107 |
background-color: #FF8C00;
|
| 108 |
color: #FFFFFF;
|
|
|
|
| 109 |
}
|
| 110 |
"""
|
| 111 |
|
|
|
|
| 8 |
# Function to add a new task
|
| 9 |
def add_task(task, priority, status):
|
| 10 |
global todo_df
|
| 11 |
+
if task.strip(): # Ensure task is not empty
|
| 12 |
new_task = pd.DataFrame([[task, priority, status]], columns=TODO_COLUMNS)
|
| 13 |
todo_df = pd.concat([todo_df, new_task], ignore_index=True)
|
| 14 |
return todo_df
|
|
|
|
| 24 |
def get_tasks():
|
| 25 |
return todo_df
|
| 26 |
|
| 27 |
+
# Initialize Gradio app with dark tech-inspired theme
|
| 28 |
with gr.Blocks() as demo:
|
| 29 |
+
gr.Markdown(
|
| 30 |
+
"""
|
| 31 |
+
<div style="text-align: center; font-size: 28px; font-weight: bold; color: #FFA500;">
|
| 32 |
+
📝 Futuristic To-Do List Tracker
|
| 33 |
+
</div>
|
| 34 |
+
""",
|
| 35 |
+
elem_id="title"
|
| 36 |
+
)
|
| 37 |
|
| 38 |
task_table = gr.Dataframe(
|
| 39 |
value=get_tasks(),
|
| 40 |
headers=TODO_COLUMNS,
|
| 41 |
interactive=False,
|
| 42 |
label="Current Tasks",
|
| 43 |
+
elem_id="task-table"
|
| 44 |
)
|
| 45 |
|
| 46 |
# Add Task Section
|
| 47 |
with gr.Row():
|
| 48 |
+
task_input = gr.Textbox(
|
| 49 |
+
label="Task",
|
| 50 |
+
placeholder="Enter your task...",
|
| 51 |
+
elem_id="input-box"
|
| 52 |
+
)
|
| 53 |
priority_input = gr.Dropdown(
|
| 54 |
choices=["Low", "Medium", "High"],
|
| 55 |
label="Priority",
|
| 56 |
value="Medium",
|
| 57 |
+
elem_id="dropdown"
|
| 58 |
)
|
| 59 |
status_input = gr.Dropdown(
|
| 60 |
choices=["Not Started", "In Progress", "Completed"],
|
| 61 |
label="Status",
|
| 62 |
value="Not Started",
|
| 63 |
+
elem_id="dropdown"
|
| 64 |
)
|
| 65 |
+
add_button = gr.Button("Add Task", elem_id="button")
|
| 66 |
|
| 67 |
add_button.click(
|
| 68 |
fn=add_task,
|
|
|
|
| 71 |
)
|
| 72 |
|
| 73 |
# Delete Task Section
|
| 74 |
+
delete_index = gr.Number(label="Task Index to Delete", value=0, elem_id="input-box")
|
| 75 |
+
delete_button = gr.Button("Delete Task", elem_id="button")
|
| 76 |
|
| 77 |
delete_button.click(
|
| 78 |
fn=delete_task,
|
|
|
|
| 80 |
outputs=task_table
|
| 81 |
)
|
| 82 |
|
| 83 |
+
# Custom CSS for Futuristic Tech Style
|
| 84 |
custom_css = """
|
| 85 |
body {
|
| 86 |
+
background-color: #181818;
|
| 87 |
+
color: #E0E0E0;
|
| 88 |
+
font-family: 'Roboto Mono', monospace;
|
| 89 |
}
|
| 90 |
+
#title {
|
| 91 |
color: #FFA500;
|
| 92 |
+
text-shadow: 0 0 8px #FF8C00;
|
|
|
|
| 93 |
}
|
| 94 |
+
#task-table {
|
| 95 |
+
background-color: #1f1f1f;
|
| 96 |
+
color: #E0E0E0;
|
| 97 |
border: 1px solid #FFA500;
|
| 98 |
+
border-radius: 8px;
|
| 99 |
}
|
| 100 |
+
#input-box {
|
| 101 |
+
background-color: #1c1c1c;
|
| 102 |
+
color: #E0E0E0;
|
| 103 |
border: 1px solid #FFA500;
|
| 104 |
+
border-radius: 8px;
|
| 105 |
+
padding: 10px;
|
| 106 |
}
|
| 107 |
+
#dropdown {
|
| 108 |
+
background-color: #1c1c1c;
|
| 109 |
+
color: #E0E0E0;
|
| 110 |
border: 1px solid #FFA500;
|
| 111 |
+
border-radius: 8px;
|
| 112 |
+
padding: 5px;
|
| 113 |
}
|
| 114 |
+
#button {
|
| 115 |
background-color: #FFA500;
|
| 116 |
+
color: #181818;
|
| 117 |
border: none;
|
| 118 |
+
border-radius: 8px;
|
| 119 |
+
padding: 10px 20px;
|
| 120 |
font-weight: bold;
|
| 121 |
+
box-shadow: 0 0 12px #FF8C00;
|
| 122 |
+
transition: all 0.2s ease-in-out;
|
| 123 |
}
|
| 124 |
+
#button:hover {
|
| 125 |
background-color: #FF8C00;
|
| 126 |
color: #FFFFFF;
|
| 127 |
+
box-shadow: 0 0 16px #FFA500;
|
| 128 |
}
|
| 129 |
"""
|
| 130 |
|