Update app.py
Browse files
app.py
CHANGED
@@ -103,8 +103,8 @@ def process_video(video_file: gr.Video, api_key: str, prompt_template: str, voic
|
|
103 |
video_table = pxt.create_table(
|
104 |
f'{dir_name}.videos',
|
105 |
{
|
106 |
-
"video": pxt.
|
107 |
-
"timestamp": pxt.
|
108 |
}
|
109 |
)
|
110 |
|
@@ -115,7 +115,7 @@ def process_video(video_file: gr.Video, api_key: str, prompt_template: str, voic
|
|
115 |
iterator=FrameIterator.create(video=video_table.video, fps=1)
|
116 |
)
|
117 |
|
118 |
-
frames_view
|
119 |
|
120 |
if progress:
|
121 |
progress(0.2, desc="Processing video...")
|
@@ -186,13 +186,13 @@ def process_video(video_file: gr.Video, api_key: str, prompt_template: str, voic
|
|
186 |
}
|
187 |
]
|
188 |
|
189 |
-
video_table
|
190 |
messages=messages,
|
191 |
model='gpt-4o',
|
192 |
max_tokens=500
|
193 |
-
)
|
194 |
|
195 |
-
video_table
|
196 |
|
197 |
if progress:
|
198 |
progress(0.8, desc="Generating audio...")
|
@@ -226,11 +226,11 @@ def process_video(video_file: gr.Video, api_key: str, prompt_template: str, voic
|
|
226 |
return None
|
227 |
|
228 |
# Generate audio and get results
|
229 |
-
video_table
|
230 |
results = video_table.select(
|
231 |
video_table.content,
|
232 |
video_table.audio_path
|
233 |
-
).tail(1)
|
234 |
|
235 |
if progress:
|
236 |
progress(1.0, desc="Processing complete!")
|
|
|
103 |
video_table = pxt.create_table(
|
104 |
f'{dir_name}.videos',
|
105 |
{
|
106 |
+
"video": pxt.Video,
|
107 |
+
"timestamp": pxt.Timestamp
|
108 |
}
|
109 |
)
|
110 |
|
|
|
115 |
iterator=FrameIterator.create(video=video_table.video, fps=1)
|
116 |
)
|
117 |
|
118 |
+
frames_view.add_computed_column(encoded_frame=image.b64_encode(frames_view.frame))
|
119 |
|
120 |
if progress:
|
121 |
progress(0.2, desc="Processing video...")
|
|
|
186 |
}
|
187 |
]
|
188 |
|
189 |
+
video_table.add_computed_column(response=openai.chat_completions(
|
190 |
messages=messages,
|
191 |
model='gpt-4o',
|
192 |
max_tokens=500
|
193 |
+
))
|
194 |
|
195 |
+
video_table.add_computed_column(content=video_table.response.choices[0].message.content.astype(pxt.StringType()))
|
196 |
|
197 |
if progress:
|
198 |
progress(0.8, desc="Generating audio...")
|
|
|
226 |
return None
|
227 |
|
228 |
# Generate audio and get results
|
229 |
+
video_table.add_computed_column(audio_path=generate_voiceover(video_table.content, voice_choice)
|
230 |
results = video_table.select(
|
231 |
video_table.content,
|
232 |
video_table.audio_path
|
233 |
+
).tail(1))
|
234 |
|
235 |
if progress:
|
236 |
progress(1.0, desc="Processing complete!")
|