Spaces:
Runtime error
Runtime error
| 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() |