Download components/assignment_view.py from yekkala/SkillSync: direct link, hf CLI and curl.
- Browser
- Download file 2.88 kB
-
https://huggingface.co/spaces/yekkala/SkillSync/resolve/main/components/assignment_view.py
- Command line
-
hf download hf://spaces/yekkala/SkillSync/components/assignment_view.py
-
curl -L -o assignment_view.py https://huggingface.co/spaces/yekkala/SkillSync/resolve/main/components/assignment_view.py
2.88 kB
| """ | |
| Assignment view component for SkillSync | |
| """ | |
| import gradio as gr | |
| from datetime import datetime | |
| def create_assignment_view(module_data, module_id, progress_manager): | |
| """Create an assignment display and submission view""" | |
| assignment = module_data['assignment'] | |
| with gr.Accordion(f"π Assignment: {assignment['title']}", open=False): | |
| gr.Markdown(f""" | |
| **Description:** {assignment['description']} | |
| **Estimated Time:** {assignment['time_estimate']} | |
| --- | |
| **Tasks:** | |
| """) | |
| for i, task in enumerate(assignment['tasks']): | |
| gr.Markdown(f"{i+1}. {task}") | |
| gr.Markdown("---") | |
| gr.Markdown("**Deliverables:**") | |
| for item in assignment['deliverables']: | |
| gr.Markdown(f"- {item}") | |
| gr.Markdown("---") | |
| gr.Markdown("### π€ Submit Assignment") | |
| with gr.Row(): | |
| with gr.Column(): | |
| submission_title = gr.Textbox( | |
| label="Submission Title", | |
| placeholder="Enter a title for your submission" | |
| ) | |
| submission_notes = gr.Textbox( | |
| label="Notes to Reviewer", | |
| lines=3, | |
| placeholder="Any additional notes or comments" | |
| ) | |
| submission_file = gr.File( | |
| label="Upload Files", | |
| file_types=[".zip", ".pdf", ".ipynb", ".py"] | |
| ) | |
| submit_btn = gr.Button("Submit Assignment", variant="primary") | |
| submission_status = gr.Markdown() | |
| def submit_assignment(title, notes, file): | |
| if not title: | |
| return "β Please provide a title for your submission." | |
| submission_data = { | |
| "title": title, | |
| "notes": notes or "", | |
| "has_file": file is not None | |
| } | |
| progress_manager.save_assignment_submission(module_id, submission_data) | |
| return f""" | |
| β **Assignment Submitted Successfully!** | |
| **Title:** {title} | |
| **Submitted at:** {datetime.now().strftime("%Y-%m-%d %H:%M:%S")} | |
| Your submission will be reviewed within 5-7 business days. | |
| """ | |
| submit_btn.click( | |
| fn=submit_assignment, | |
| inputs=[submission_title, submission_notes, submission_file], | |
| outputs=[submission_status] | |
| ) | |