Spaces:
Build error
Build error
Update app.py
Browse files
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 |
-
|
|
|
|
|
|
|
|
|
|
| 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}")
|