chenemii commited on
Commit
4416c36
·
1 Parent(s): 788ad63
app/main.py CHANGED
@@ -13,12 +13,12 @@ load_dotenv()
13
  # Add the app directory to the path
14
  sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
15
 
16
- from app.utils.video_downloader import download_youtube_video, cleanup_video_file
17
- from app.utils.video_processor import process_video
18
- from app.models.pose_estimator import analyze_pose
19
- from app.models.swing_analyzer import segment_swing, analyze_trajectory
20
- from app.models.llm_analyzer import generate_swing_analysis
21
- from app.utils.visualizer import create_annotated_video
22
 
23
 
24
  def main():
 
13
  # Add the app directory to the path
14
  sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
15
 
16
+ from utils.video_downloader import download_youtube_video, cleanup_video_file
17
+ from utils.video_processor import process_video
18
+ from models.pose_estimator import analyze_pose
19
+ from models.swing_analyzer import segment_swing, analyze_trajectory
20
+ from models.llm_analyzer import generate_swing_analysis
21
+ from utils.visualizer import create_annotated_video
22
 
23
 
24
  def main():
app/models/llm_analyzer.py CHANGED
@@ -8,7 +8,7 @@ from openai import OpenAI
8
  import streamlit as st
9
  import re
10
  import numpy as np
11
- from app.models.pose_estimator import calculate_joint_angles
12
 
13
 
14
  def check_llm_services():
@@ -265,7 +265,7 @@ def prepare_data_for_llm(pose_data, swing_phases, trajectory_data=None):
265
 
266
  if rep_frame and rep_frame in pose_data:
267
  try:
268
- from app.models.pose_estimator import calculate_joint_angles
269
  joint_angles = calculate_joint_angles(pose_data[rep_frame])
270
  except Exception as e:
271
  print(f"Error calculating joint angles: {e}")
 
8
  import streamlit as st
9
  import re
10
  import numpy as np
11
+ from .pose_estimator import calculate_joint_angles
12
 
13
 
14
  def check_llm_services():
 
265
 
266
  if rep_frame and rep_frame in pose_data:
267
  try:
268
+ from .pose_estimator import calculate_joint_angles
269
  joint_angles = calculate_joint_angles(pose_data[rep_frame])
270
  except Exception as e:
271
  print(f"Error calculating joint angles: {e}")
app/models/swing_analyzer.py CHANGED
@@ -3,7 +3,7 @@ Swing analysis module for golf swing segmentation and trajectory analysis
3
  """
4
 
5
  import numpy as np
6
- from app.models.pose_estimator import calculate_joint_angles
7
 
8
 
9
  def find_top_of_backswing(pose_data):
 
3
  """
4
 
5
  import numpy as np
6
+ from .pose_estimator import calculate_joint_angles
7
 
8
 
9
  def find_top_of_backswing(pose_data):
app/streamlit_app.py CHANGED
@@ -20,17 +20,17 @@ load_dotenv()
20
  # Add the app directory to the path
21
  sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
22
 
23
- from app.utils.video_downloader import download_youtube_video, download_pro_reference, cleanup_video_file, cleanup_downloads_directory
24
- from app.utils.video_processor import process_video
25
- from app.models.pose_estimator import analyze_pose
26
- from app.models.swing_analyzer import segment_swing, analyze_trajectory
27
- from app.models.llm_analyzer import generate_swing_analysis, create_llm_prompt, prepare_data_for_llm, check_llm_services, parse_and_format_analysis, display_formatted_analysis
28
- from app.utils.visualizer import create_annotated_video
29
- from app.utils.comparison import create_key_frame_comparison, extract_key_swing_frames
30
 
31
  # Import RAG functionality
32
  try:
33
- from app.golf_swing_rag import GolfSwingRAG
34
  RAG_AVAILABLE = True
35
  except ImportError:
36
  RAG_AVAILABLE = False
 
20
  # Add the app directory to the path
21
  sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
22
 
23
+ from utils.video_downloader import download_youtube_video, download_pro_reference, cleanup_video_file, cleanup_downloads_directory
24
+ from utils.video_processor import process_video
25
+ from models.pose_estimator import analyze_pose
26
+ from models.swing_analyzer import segment_swing, analyze_trajectory
27
+ from models.llm_analyzer import generate_swing_analysis, create_llm_prompt, prepare_data_for_llm, check_llm_services, parse_and_format_analysis, display_formatted_analysis
28
+ from utils.visualizer import create_annotated_video
29
+ from utils.comparison import create_key_frame_comparison, extract_key_swing_frames
30
 
31
  # Import RAG functionality
32
  try:
33
+ from golf_swing_rag import GolfSwingRAG
34
  RAG_AVAILABLE = True
35
  except ImportError:
36
  RAG_AVAILABLE = False