Spaces:
Sleeping
Sleeping
test
Browse files
app.py
CHANGED
|
@@ -31,10 +31,10 @@ def process_video(video_path):
|
|
| 31 |
count = 0
|
| 32 |
success = True
|
| 33 |
frame_captions = {"Model 1": [], "Model 2": [], "Model 3": []}
|
| 34 |
-
|
| 35 |
while success:
|
| 36 |
success, frame = vidObj.read()
|
| 37 |
-
|
| 38 |
if not success:
|
| 39 |
break
|
| 40 |
|
|
@@ -68,26 +68,19 @@ def process_video(video_path):
|
|
| 68 |
|
| 69 |
# Gradio Interface
|
| 70 |
def generate_captions(video):
|
| 71 |
-
|
| 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 |
-
|
| 91 |
with gr.Blocks() as demo:
|
| 92 |
gr.Markdown("# Video Captioning with Multiple Models 🎥")
|
| 93 |
gr.Markdown("Upload a video to generate captions for its frames using three different models.")
|
|
|
|
| 31 |
count = 0
|
| 32 |
success = True
|
| 33 |
frame_captions = {"Model 1": [], "Model 2": [], "Model 3": []}
|
| 34 |
+
print("LOGX")
|
| 35 |
while success:
|
| 36 |
success, frame = vidObj.read()
|
| 37 |
+
print("LOGY")
|
| 38 |
if not success:
|
| 39 |
break
|
| 40 |
|
|
|
|
| 68 |
|
| 69 |
# Gradio Interface
|
| 70 |
def generate_captions(video):
|
| 71 |
+
print("LOG1")
|
|
|
|
|
|
|
|
|
|
| 72 |
captions = process_video(video)
|
| 73 |
+
print("LOG PO")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
result = ""
|
| 75 |
for model_name, model_captions in captions.items():
|
| 76 |
result += f"### {model_name}\n"
|
| 77 |
result += "\n".join(f"- {caption}" for caption in model_captions)
|
| 78 |
result += "\n\n"
|
| 79 |
+
print("LOG KONIEc")
|
| 80 |
return result
|
| 81 |
|
| 82 |
|
| 83 |
+
|
| 84 |
with gr.Blocks() as demo:
|
| 85 |
gr.Markdown("# Video Captioning with Multiple Models 🎥")
|
| 86 |
gr.Markdown("Upload a video to generate captions for its frames using three different models.")
|