Upload 4 files
Browse files- README.md +1 -1
- app.py +37 -60
- requirements.txt +2 -1
README.md
CHANGED
|
@@ -4,7 +4,7 @@ emoji: 🎬
|
|
| 4 |
colorFrom: blue
|
| 5 |
colorTo: purple
|
| 6 |
sdk: gradio
|
| 7 |
-
sdk_version: 4.
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
license: apache-2.0
|
|
|
|
| 4 |
colorFrom: blue
|
| 5 |
colorTo: purple
|
| 6 |
sdk: gradio
|
| 7 |
+
sdk_version: 4.44.1
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
license: apache-2.0
|
app.py
CHANGED
|
@@ -334,15 +334,13 @@ def process_video_with_minicpm(video_file):
|
|
| 334 |
|
| 335 |
# Create Gradio interface
|
| 336 |
def create_interface():
|
| 337 |
-
|
| 338 |
-
|
| 339 |
-
|
| 340 |
-
|
| 341 |
-
|
| 342 |
-
|
| 343 |
-
|
| 344 |
-
model_color = "red"
|
| 345 |
-
|
| 346 |
gr.Markdown(f"""
|
| 347 |
# 🎬 MiniCPM-o Video Analyzer
|
| 348 |
|
|
@@ -350,72 +348,52 @@ def create_interface():
|
|
| 350 |
|
| 351 |
{model_status}
|
| 352 |
|
| 353 |
-
Upload a marketing video (up to 30 seconds) to get
|
| 354 |
-
- 🎯 Frame-by-frame narrative analysis
|
| 355 |
-
- 🎨 Visual psychology insights
|
| 356 |
-
- 🚀 Marketing effectiveness analysis
|
| 357 |
-
- 📊 Comprehensive summary
|
| 358 |
|
| 359 |
*Powered by MiniCPM-o 2.6 - Local multimodal analysis*
|
| 360 |
""")
|
| 361 |
|
| 362 |
-
|
| 363 |
-
|
| 364 |
-
|
| 365 |
-
|
| 366 |
-
|
| 367 |
-
|
| 368 |
-
|
| 369 |
-
|
| 370 |
-
|
| 371 |
-
|
| 372 |
-
|
| 373 |
-
|
| 374 |
-
|
| 375 |
-
|
| 376 |
-
|
| 377 |
-
|
| 378 |
-
|
| 379 |
-
|
| 380 |
-
|
| 381 |
-
|
| 382 |
-
|
| 383 |
-
|
| 384 |
-
|
| 385 |
-
|
| 386 |
-
|
| 387 |
-
|
| 388 |
-
value="Upload a video and click 'Analyze with MiniCPM-o' to get started."
|
| 389 |
-
)
|
| 390 |
-
|
| 391 |
-
with gr.TabItem("🎬 Frame Analysis"):
|
| 392 |
-
frame_output = gr.Markdown(
|
| 393 |
-
label="Frame-by-Frame Analysis",
|
| 394 |
-
value="Detailed analysis of each frame will appear here."
|
| 395 |
-
)
|
| 396 |
-
|
| 397 |
-
with gr.TabItem("📝 Summary"):
|
| 398 |
-
summary_output = gr.Markdown(
|
| 399 |
-
label="Executive Summary",
|
| 400 |
-
value="Marketing effectiveness summary will appear here."
|
| 401 |
-
)
|
| 402 |
|
| 403 |
# Event handlers
|
| 404 |
analyze_btn.click(
|
| 405 |
fn=process_video_with_minicpm,
|
| 406 |
-
inputs=
|
| 407 |
outputs=[report_output, frame_output, summary_output]
|
| 408 |
)
|
| 409 |
|
| 410 |
-
# Examples
|
| 411 |
gr.Markdown("""
|
| 412 |
## 🎯 What This Analysis Provides
|
| 413 |
|
| 414 |
- **Narrative Analysis**: Story structure and progression
|
| 415 |
-
- **Visual Psychology**: Color, composition, and emotional triggers
|
| 416 |
- **Marketing Mechanics**: Persuasion techniques and conversion strategies
|
| 417 |
- **Attention Engineering**: How the video captures and maintains viewer focus
|
| 418 |
-
- **Comparative Insights**: How this compares to your existing GPT-4o analysis
|
| 419 |
""")
|
| 420 |
|
| 421 |
return demo
|
|
@@ -425,6 +403,5 @@ if __name__ == "__main__":
|
|
| 425 |
demo = create_interface()
|
| 426 |
demo.launch(
|
| 427 |
server_name="0.0.0.0",
|
| 428 |
-
server_port=7860
|
| 429 |
-
share=True
|
| 430 |
)
|
|
|
|
| 334 |
|
| 335 |
# Create Gradio interface
|
| 336 |
def create_interface():
|
| 337 |
+
# Show model status
|
| 338 |
+
if model and tokenizer:
|
| 339 |
+
model_status = "✅ **Model Status**: MiniCPM-o 2.6 loaded successfully"
|
| 340 |
+
else:
|
| 341 |
+
model_status = "❌ **Model Status**: MiniCPM-o 2.6 not loaded (check logs)"
|
| 342 |
+
|
| 343 |
+
with gr.Blocks(title="MiniCPM-o Video Analyzer") as demo:
|
|
|
|
|
|
|
| 344 |
gr.Markdown(f"""
|
| 345 |
# 🎬 MiniCPM-o Video Analyzer
|
| 346 |
|
|
|
|
| 348 |
|
| 349 |
{model_status}
|
| 350 |
|
| 351 |
+
Upload a marketing video (up to 30 seconds) to get comprehensive AI analysis.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 352 |
|
| 353 |
*Powered by MiniCPM-o 2.6 - Local multimodal analysis*
|
| 354 |
""")
|
| 355 |
|
| 356 |
+
# Simple layout
|
| 357 |
+
video_input = gr.Video(label="Upload Marketing Video")
|
| 358 |
+
analyze_btn = gr.Button("🚀 Analyze with MiniCPM-o", variant="primary")
|
| 359 |
+
|
| 360 |
+
gr.Markdown("**Results will appear below:**")
|
| 361 |
+
|
| 362 |
+
report_output = gr.Textbox(
|
| 363 |
+
label="📊 Analysis Report",
|
| 364 |
+
lines=10,
|
| 365 |
+
value="Upload a video and click 'Analyze with MiniCPM-o' to get started.",
|
| 366 |
+
interactive=False
|
| 367 |
+
)
|
| 368 |
+
|
| 369 |
+
frame_output = gr.Textbox(
|
| 370 |
+
label="🎬 Frame Analysis",
|
| 371 |
+
lines=8,
|
| 372 |
+
value="Detailed analysis of each frame will appear here.",
|
| 373 |
+
interactive=False
|
| 374 |
+
)
|
| 375 |
+
|
| 376 |
+
summary_output = gr.Textbox(
|
| 377 |
+
label="📝 Executive Summary",
|
| 378 |
+
lines=6,
|
| 379 |
+
value="Marketing effectiveness summary will appear here.",
|
| 380 |
+
interactive=False
|
| 381 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 382 |
|
| 383 |
# Event handlers
|
| 384 |
analyze_btn.click(
|
| 385 |
fn=process_video_with_minicpm,
|
| 386 |
+
inputs=video_input,
|
| 387 |
outputs=[report_output, frame_output, summary_output]
|
| 388 |
)
|
| 389 |
|
|
|
|
| 390 |
gr.Markdown("""
|
| 391 |
## 🎯 What This Analysis Provides
|
| 392 |
|
| 393 |
- **Narrative Analysis**: Story structure and progression
|
| 394 |
+
- **Visual Psychology**: Color, composition, and emotional triggers
|
| 395 |
- **Marketing Mechanics**: Persuasion techniques and conversion strategies
|
| 396 |
- **Attention Engineering**: How the video captures and maintains viewer focus
|
|
|
|
| 397 |
""")
|
| 398 |
|
| 399 |
return demo
|
|
|
|
| 403 |
demo = create_interface()
|
| 404 |
demo.launch(
|
| 405 |
server_name="0.0.0.0",
|
| 406 |
+
server_port=7860
|
|
|
|
| 407 |
)
|
requirements.txt
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
torch>=2.1.0
|
| 2 |
transformers>=4.35.0
|
| 3 |
-
gradio==4.
|
|
|
|
| 4 |
opencv-python>=4.8.0
|
| 5 |
numpy>=1.24.0
|
| 6 |
pillow>=10.0.0
|
|
|
|
| 1 |
torch>=2.1.0
|
| 2 |
transformers>=4.35.0
|
| 3 |
+
gradio==4.44.1
|
| 4 |
+
torchaudio>=2.1.0
|
| 5 |
opencv-python>=4.8.0
|
| 6 |
numpy>=1.24.0
|
| 7 |
pillow>=10.0.0
|