Spaces:
Runtime error
Runtime error
Download frontend/app.py from venkata1995/TaskManager: direct link, hf CLI and curl.
- Browser
- Download file 729 Bytes
-
https://huggingface.co/spaces/venkata1995/TaskManager/resolve/main/frontend/app.py
- Command line
-
hf download hf://spaces/venkata1995/TaskManager/frontend/app.py
-
curl -L -o app.py https://huggingface.co/spaces/venkata1995/TaskManager/resolve/main/frontend/app.py
729 Bytes
| import gradio as gr | |
| import requests | |
| API_URL = "http://localhost:8000" # Change to internal URL in Docker if needed | |
| def add_task_ui(title): | |
| response = requests.post(f"{API_URL}/tasks/", json={"id": "", "title": title, "completed": False}) | |
| return get_tasks_ui() | |
| def get_tasks_ui(): | |
| response = requests.get(f"{API_URL}/tasks/") | |
| return [f"{task['title']} - {'✔️' if task['completed'] else '❌'}" for task in response.json()] | |
| with gr.Blocks() as demo: | |
| with gr.Row(): | |
| task_input = gr.Textbox(label="New Task") | |
| add_button = gr.Button("Add Task") | |
| task_list = gr.Textbox(label="Tasks", lines=10) | |
| add_button.click(add_task_ui, inputs=task_input, outputs=task_list) | |
| demo.launch() | |