Spaces:
Running
Running
add base64 representation of video to response
Browse files
app.py
CHANGED
|
@@ -85,7 +85,7 @@ def upload_video_to_r2(video_path, bucket_name="asl-videos"):
|
|
| 85 |
video_file,
|
| 86 |
bucket_name,
|
| 87 |
unique_filename,
|
| 88 |
-
ExtraArgs={'ACL': 'public-read'}
|
| 89 |
)
|
| 90 |
|
| 91 |
# Replace the endpoint with the domain for uploading
|
|
@@ -254,6 +254,7 @@ async def parse_vectorize_and_search_unified(input_data):
|
|
| 254 |
if video_file != stitched_video_path: # Don't delete the final output
|
| 255 |
cleanup_temp_video(video_file)
|
| 256 |
|
|
|
|
| 257 |
# Return simplified results
|
| 258 |
return {
|
| 259 |
"status": "success",
|
|
@@ -261,7 +262,8 @@ async def parse_vectorize_and_search_unified(input_data):
|
|
| 261 |
"video_count": len(videos),
|
| 262 |
"gloss": gloss,
|
| 263 |
"cleaned_tokens": cleaned_tokens,
|
| 264 |
-
"video_download_url": video_download_url
|
|
|
|
| 265 |
}, stitched_video_path
|
| 266 |
|
| 267 |
|
|
|
|
| 85 |
video_file,
|
| 86 |
bucket_name,
|
| 87 |
unique_filename,
|
| 88 |
+
ExtraArgs={'ACL': 'public-read', 'ContentType': 'video/mp4'}
|
| 89 |
)
|
| 90 |
|
| 91 |
# Replace the endpoint with the domain for uploading
|
|
|
|
| 254 |
if video_file != stitched_video_path: # Don't delete the final output
|
| 255 |
cleanup_temp_video(video_file)
|
| 256 |
|
| 257 |
+
video64 = video_to_base64(stitched_video_path)
|
| 258 |
# Return simplified results
|
| 259 |
return {
|
| 260 |
"status": "success",
|
|
|
|
| 262 |
"video_count": len(videos),
|
| 263 |
"gloss": gloss,
|
| 264 |
"cleaned_tokens": cleaned_tokens,
|
| 265 |
+
"video_download_url": video_download_url,
|
| 266 |
+
"video_as_base_64": video64
|
| 267 |
}, stitched_video_path
|
| 268 |
|
| 269 |
|