sschmied commited on
Commit
9759d11
·
verified ·
1 Parent(s): 9d90f6f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -7
app.py CHANGED
@@ -1,4 +1,3 @@
1
- # %%
2
  # %%pip install mediapipe gradio plotly matplotlib pyttsx3 opencv-python --quiet
3
 
4
  # Import packages
@@ -135,7 +134,6 @@ def create_3d_skeleton(skeleton_coords):
135
  ),
136
  showlegend=False
137
  ))
138
-
139
 
140
  # Calculate axis ranges for consistent scaling
141
  x_values = np.array(x)
@@ -174,7 +172,6 @@ def create_3d_skeleton(skeleton_coords):
174
 
175
  return fig
176
 
177
-
178
  def generate_plot_frame(data, current_frame):
179
  global reduced_FRAMERATE
180
 
@@ -290,7 +287,6 @@ def process_frame(frame, angles_data, frame_idx, media):
290
  )
291
  cv2.arrowedLine(black_frame, start_point, end_point, (0, 0, 255), 2)
292
 
293
-
294
  # Draw feedback text
295
  cv2.putText(black_frame, f"Back: {back_angle:.1f}", (10, 30), cv2.FONT_HERSHEY_SIMPLEX, 0.7, (0, 255, 0), 2)
296
  cv2.putText(black_frame, f"Head: {head_angle:.1f}", (10, 60), cv2.FONT_HERSHEY_SIMPLEX, 0.7, (0, 255, 0), 2)
@@ -388,7 +384,7 @@ def process_video(video_path=None):
388
 
389
  # Video writer setup with original dimensions
390
  pose_video = f"output/pose_video-{datetime.now().strftime('%Y%m%d%H%M')}.mp4"
391
- out = cv2.VideoWriter(pose_video, cv2.VideoWriter_fourcc(*'avc1'), reduced_FRAMERATE, (original_width, original_height))
392
 
393
  try:
394
  frame_idx = 0
@@ -439,7 +435,9 @@ def build_gradio_interface():
439
  with gr.Blocks(title="Surf Pop-Up Trainer", theme="soft") as app:
440
  speak_message("Welcome to the Pop-Up Trainer")
441
 
442
- gr.Markdown("![Schmied Research And Development Pty Ltd Logo](./Logo/Logo.jpg)")
 
 
443
  gr.Markdown("<h1 style='text-align: center;'>A Surfing Pop-Up Trainer</h1>")
444
  gr.Markdown(
445
  "<p style='text-align: center;'>©Schmied Research And Development Pty Ltd. Dr Steven Schmied. "
@@ -506,7 +504,6 @@ def build_gradio_interface():
506
  inputs=vid_input
507
  )
508
 
509
-
510
  with gr.Tab("Instructions"):
511
  gr.Markdown("<p style='text-align: center;'>To run the analysis, either a. use your webcam or b. upload a photo or video</p>)")
512
  gr.Markdown("<p style='text-align: center;'>The analysis will take a few seconds to process</p>")
 
 
1
  # %%pip install mediapipe gradio plotly matplotlib pyttsx3 opencv-python --quiet
2
 
3
  # Import packages
 
134
  ),
135
  showlegend=False
136
  ))
 
137
 
138
  # Calculate axis ranges for consistent scaling
139
  x_values = np.array(x)
 
172
 
173
  return fig
174
 
 
175
  def generate_plot_frame(data, current_frame):
176
  global reduced_FRAMERATE
177
 
 
287
  )
288
  cv2.arrowedLine(black_frame, start_point, end_point, (0, 0, 255), 2)
289
 
 
290
  # Draw feedback text
291
  cv2.putText(black_frame, f"Back: {back_angle:.1f}", (10, 30), cv2.FONT_HERSHEY_SIMPLEX, 0.7, (0, 255, 0), 2)
292
  cv2.putText(black_frame, f"Head: {head_angle:.1f}", (10, 60), cv2.FONT_HERSHEY_SIMPLEX, 0.7, (0, 255, 0), 2)
 
384
 
385
  # Video writer setup with original dimensions
386
  pose_video = f"output/pose_video-{datetime.now().strftime('%Y%m%d%H%M')}.mp4"
387
+ out = cv2.VideoWriter(pose_video, cv2.VideoWriter_fourcc(*'mp4v'), reduced_FRAMERATE, (original_width, original_height))
388
 
389
  try:
390
  frame_idx = 0
 
435
  with gr.Blocks(title="Surf Pop-Up Trainer", theme="soft") as app:
436
  speak_message("Welcome to the Pop-Up Trainer")
437
 
438
+ gr.HTML("<img src='Logo/Logo.jpg'")
439
+
440
+ # gr.Markdown("![Schmied Research And Development Pty Ltd Logo](./Logo/Logo.jpg)")
441
  gr.Markdown("<h1 style='text-align: center;'>A Surfing Pop-Up Trainer</h1>")
442
  gr.Markdown(
443
  "<p style='text-align: center;'>©Schmied Research And Development Pty Ltd. Dr Steven Schmied. "
 
504
  inputs=vid_input
505
  )
506
 
 
507
  with gr.Tab("Instructions"):
508
  gr.Markdown("<p style='text-align: center;'>To run the analysis, either a. use your webcam or b. upload a photo or video</p>)")
509
  gr.Markdown("<p style='text-align: center;'>The analysis will take a few seconds to process</p>")