Spaces:
Sleeping
Sleeping
test
Browse files
app.py
CHANGED
|
@@ -69,27 +69,22 @@ def process_video(video_path):
|
|
| 69 |
# Gradio Interface
|
| 70 |
def generate_captions(video):
|
| 71 |
# Save uploaded video
|
| 72 |
-
video_path = f"temp_{uuid.uuid4()}.mp4"
|
| 73 |
print(video)
|
| 74 |
-
print("LOG")
|
| 75 |
-
# with open(video_path, "wb") as f:
|
| 76 |
-
# f.write(video.read())
|
| 77 |
|
| 78 |
-
#
|
| 79 |
-
|
| 80 |
|
| 81 |
-
#
|
| 82 |
-
|
| 83 |
|
| 84 |
-
#
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
|
| 91 |
-
|
| 92 |
-
return ""
|
| 93 |
|
| 94 |
|
| 95 |
# Gradio UI
|
|
|
|
| 69 |
# Gradio Interface
|
| 70 |
def generate_captions(video):
|
| 71 |
# Save uploaded video
|
|
|
|
| 72 |
print(video)
|
|
|
|
|
|
|
|
|
|
| 73 |
|
| 74 |
+
# Process video and get captions
|
| 75 |
+
captions = process_video(video)
|
| 76 |
|
| 77 |
+
# Clean up temporary file
|
| 78 |
+
os.remove(video)
|
| 79 |
|
| 80 |
+
# Format output for display
|
| 81 |
+
result = ""
|
| 82 |
+
for model_name, model_captions in captions.items():
|
| 83 |
+
result += f"### {model_name}\n"
|
| 84 |
+
result += "\n".join(f"- {caption}" for caption in model_captions)
|
| 85 |
+
result += "\n\n"
|
| 86 |
|
| 87 |
+
return result
|
|
|
|
| 88 |
|
| 89 |
|
| 90 |
# Gradio UI
|