hardik8588 commited on
Commit
aabf910
·
verified ·
1 Parent(s): e2fb47a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -460,7 +460,10 @@ def process_video_to_text(video_file_path):
460
  """Extract audio from video and convert to text."""
461
  try:
462
  print(f"Processing video file at {video_file_path}")
463
- temp_audio_path = os.path.join("temp", "extracted_audio.wav")
 
 
 
464
  video = mp.VideoFileClip(video_file_path)
465
  video.audio.write_audiofile(temp_audio_path, codec='pcm_s16le')
466
  print(f"Audio extracted to {temp_audio_path}")
 
460
  """Extract audio from video and convert to text."""
461
  try:
462
  print(f"Processing video file at {video_file_path}")
463
+ # Use /tmp/temp for Hugging Face Spaces compatibility
464
+ temp_dir = "/tmp/temp"
465
+ os.makedirs(temp_dir, exist_ok=True)
466
+ temp_audio_path = os.path.join(temp_dir, "extracted_audio.wav")
467
  video = mp.VideoFileClip(video_file_path)
468
  video.audio.write_audiofile(temp_audio_path, codec='pcm_s16le')
469
  print(f"Audio extracted to {temp_audio_path}")