Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -70,8 +70,10 @@ def display_results(video_url, video_file, description):
|
|
70 |
if not scenes:
|
71 |
return "No scenes detected", None, None
|
72 |
|
73 |
-
|
74 |
-
if
|
|
|
|
|
75 |
final_clip = extract_best_scene(video_path, best_scene)
|
76 |
if final_clip:
|
77 |
output_dir = "output"
|
@@ -79,12 +81,19 @@ def display_results(video_url, video_file, description):
|
|
79 |
final_clip_path = os.path.join(output_dir, f"{uuid.uuid4()}_final_clip.mp4")
|
80 |
final_clip.write_videofile(final_clip_path, codec='libx264', audio_codec='aac')
|
81 |
cleanup_temp_files()
|
82 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
else:
|
84 |
return "No matching scene found", None
|
85 |
else:
|
86 |
return "No suitable scenes found", None
|
87 |
|
|
|
88 |
# Custom CSS for additional styling
|
89 |
css = """
|
90 |
body {
|
|
|
70 |
if not scenes:
|
71 |
return "No scenes detected", None, None
|
72 |
|
73 |
+
best_scene_info = analyze_scenes(video_path, scenes, description)
|
74 |
+
if best_scene_info:
|
75 |
+
best_scene = best_scene_info[0]
|
76 |
+
sentiment_distribution = best_scene_info[4] # Ensure you're accessing the correct index for sentiment_distribution
|
77 |
final_clip = extract_best_scene(video_path, best_scene)
|
78 |
if final_clip:
|
79 |
output_dir = "output"
|
|
|
81 |
final_clip_path = os.path.join(output_dir, f"{uuid.uuid4()}_final_clip.mp4")
|
82 |
final_clip.write_videofile(final_clip_path, codec='libx264', audio_codec='aac')
|
83 |
cleanup_temp_files()
|
84 |
+
|
85 |
+
# Check if sentiment_distribution is correctly obtained
|
86 |
+
if sentiment_distribution:
|
87 |
+
plot = create_radial_plot(sentiment_distribution)
|
88 |
+
return final_clip_path, plot
|
89 |
+
else:
|
90 |
+
return final_clip_path, "No sentiment data available"
|
91 |
else:
|
92 |
return "No matching scene found", None
|
93 |
else:
|
94 |
return "No suitable scenes found", None
|
95 |
|
96 |
+
|
97 |
# Custom CSS for additional styling
|
98 |
css = """
|
99 |
body {
|