Update app.py
Browse files
app.py
CHANGED
|
@@ -139,10 +139,6 @@ def refresh_ui(tasks, files):
|
|
| 139 |
tasks_html = build_tasks_html(tasks)
|
| 140 |
return tasks, files, tasks_html
|
| 141 |
|
| 142 |
-
def set_sample_command(sample_command):
|
| 143 |
-
"""Returns the sample command to be populated in the textbox."""
|
| 144 |
-
return sample_command
|
| 145 |
-
|
| 146 |
def main():
|
| 147 |
# Start the background task processor.
|
| 148 |
processor_thread = threading.Thread(target=background_task_processor, daemon=True)
|
|
@@ -166,9 +162,9 @@ def main():
|
|
| 166 |
# Row of sample command buttons.
|
| 167 |
gr.Markdown("#### Sample Commands")
|
| 168 |
with gr.Row():
|
| 169 |
-
sample1 = gr.Button("Report on
|
| 170 |
-
sample2 = gr.Button("
|
| 171 |
-
sample3 = gr.Button("
|
| 172 |
|
| 173 |
gr.Markdown("### Task List")
|
| 174 |
tasks_html_output = gr.HTML(label="Tasks Overview")
|
|
@@ -189,10 +185,10 @@ def main():
|
|
| 189 |
inputs=[command_input, tasks_state],
|
| 190 |
outputs=[tasks_state, files_state, command_input]
|
| 191 |
)
|
| 192 |
-
# Sample buttons fill the command textbox.
|
| 193 |
-
sample1.click(
|
| 194 |
-
sample2.click(
|
| 195 |
-
sample3.click(
|
| 196 |
|
| 197 |
# Refresh the task list when the refresh button is clicked.
|
| 198 |
refresh_btn.click(
|
|
|
|
| 139 |
tasks_html = build_tasks_html(tasks)
|
| 140 |
return tasks, files, tasks_html
|
| 141 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 142 |
def main():
|
| 143 |
# Start the background task processor.
|
| 144 |
processor_thread = threading.Thread(target=background_task_processor, daemon=True)
|
|
|
|
| 162 |
# Row of sample command buttons.
|
| 163 |
gr.Markdown("#### Sample Commands")
|
| 164 |
with gr.Row():
|
| 165 |
+
sample1 = gr.Button("Report on US Unemployment 2024")
|
| 166 |
+
sample2 = gr.Button("Diagram of Sales Data")
|
| 167 |
+
sample3 = gr.Button("CSV Report of User Activity")
|
| 168 |
|
| 169 |
gr.Markdown("### Task List")
|
| 170 |
tasks_html_output = gr.HTML(label="Tasks Overview")
|
|
|
|
| 185 |
inputs=[command_input, tasks_state],
|
| 186 |
outputs=[tasks_state, files_state, command_input]
|
| 187 |
)
|
| 188 |
+
# Sample buttons fill the command textbox using lambda functions.
|
| 189 |
+
sample1.click(lambda: "generate a report on unemployment in the United States in 2024", None, command_input)
|
| 190 |
+
sample2.click(lambda: "generate diagram of sales data", None, command_input)
|
| 191 |
+
sample3.click(lambda: "generate csv report of user activity", None, command_input)
|
| 192 |
|
| 193 |
# Refresh the task list when the refresh button is clicked.
|
| 194 |
refresh_btn.click(
|