Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -10,7 +10,6 @@ from concurrent.futures import ThreadPoolExecutor, as_completed
|
|
10 |
from datetime import datetime
|
11 |
import json
|
12 |
import os
|
13 |
-
from moviepy.editor import ImageSequenceClip
|
14 |
from gradio_client import Client, file
|
15 |
import subprocess
|
16 |
import ffmpeg
|
@@ -88,21 +87,6 @@ def encode_to_video_fast(frames, fps):
|
|
88 |
|
89 |
return video_clip_path
|
90 |
|
91 |
-
|
92 |
-
def encode_to_video(frames, fps):
|
93 |
-
os.makedirs('videos', exist_ok=True)
|
94 |
-
video_clip_path = f"videos/{uuid.uuid4()}.mp4"
|
95 |
-
|
96 |
-
# Create a video clip from the frames using moviepy
|
97 |
-
clip = ImageSequenceClip([frame[:, :, ::-1] for frame in frames], fps=fps) # Convert from BGR to RGB
|
98 |
-
clip.write_videofile(video_clip_path, codec="libx264")
|
99 |
-
|
100 |
-
# Convert the video file to base64
|
101 |
-
with open(video_clip_path, "rb") as video_file:
|
102 |
-
video_data = base64.b64encode(video_file.read()).decode('utf-8')
|
103 |
-
|
104 |
-
return video_clip_path
|
105 |
-
|
106 |
# Function to process video frames using GPT-4 API
|
107 |
def process_frames(frames, frames_to_skip = 1):
|
108 |
os.makedirs('saved_frames', exist_ok=True)
|
|
|
10 |
from datetime import datetime
|
11 |
import json
|
12 |
import os
|
|
|
13 |
from gradio_client import Client, file
|
14 |
import subprocess
|
15 |
import ffmpeg
|
|
|
87 |
|
88 |
return video_clip_path
|
89 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
# Function to process video frames using GPT-4 API
|
91 |
def process_frames(frames, frames_to_skip = 1):
|
92 |
os.makedirs('saved_frames', exist_ok=True)
|