Spaces:
Runtime error
Runtime error
Download app.py from bsmith3715/DEMO_PROJECT_2: direct link, hf CLI and curl.
- Browser
- Download file 1.09 kB
-
https://huggingface.co/spaces/bsmith3715/DEMO_PROJECT_2/resolve/main/app.py
- Command line
-
hf download hf://spaces/bsmith3715/DEMO_PROJECT_2/app.py
-
curl -L -o app.py https://huggingface.co/spaces/bsmith3715/DEMO_PROJECT_2/resolve/main/app.py
1.09 kB
| import chainlit as cl | |
| from pilates_evaluator import PilatesVideoEvaluator | |
| async def start(): | |
| await cl.Message(content="Welcome! Upload a video to analyze your Pilates exercise.").send() | |
| async def main(message: cl.Message): | |
| if not message.elements: | |
| await cl.Message(content="Please upload a video file.").send() | |
| return | |
| video_file = message.elements[0] | |
| if not video_file.name.endswith(('.mp4', '.avi', '.mov')): | |
| await cl.Message(content="Please upload a valid video file (mp4, avi, mov).").send() | |
| return | |
| await cl.Message(content=f"Analyzing video: {video_file.name}...").send() | |
| evaluator = PilatesVideoEvaluator() | |
| try: | |
| evaluator.process_video(video_file.path) | |
| report_path = "pilates_evaluation_report.json" | |
| evaluator.generate_report(report_path) | |
| await cl.Message(content=f"Analysis complete! Report saved to {report_path}.").send() | |
| except Exception as e: | |
| await cl.Message(content=f"Error analyzing video: {e}").send() |