Spaces:
Paused
Paused
fix
Browse files- app/main.py +6 -6
- app/models/llm_analyzer.py +2 -2
- app/models/swing_analyzer.py +1 -1
- app/streamlit_app.py +8 -8
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
|
| 17 |
-
from
|
| 18 |
-
from
|
| 19 |
-
from
|
| 20 |
-
from
|
| 21 |
-
from
|
| 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
|
| 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
|
| 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
|
| 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
|
| 24 |
-
from
|
| 25 |
-
from
|
| 26 |
-
from
|
| 27 |
-
from
|
| 28 |
-
from
|
| 29 |
-
from
|
| 30 |
|
| 31 |
# Import RAG functionality
|
| 32 |
try:
|
| 33 |
-
from
|
| 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
|