Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -69,8 +69,11 @@ def display_results(video_url, video_file, description):
|
|
69 |
if not scenes:
|
70 |
return "No scenes detected", None, "No data"
|
71 |
|
72 |
-
|
73 |
-
|
|
|
|
|
|
|
74 |
if final_clip:
|
75 |
output_dir = "output"
|
76 |
os.makedirs(output_dir, exist_ok=True)
|
@@ -143,16 +146,14 @@ def save_uploaded_file(uploaded_file):
|
|
143 |
|
144 |
with gr.Blocks(theme=custom_theme, css=css) as demo:
|
145 |
with gr.Column():
|
146 |
-
gr.Markdown("# **Sickstadium AI**"
|
147 |
-
gr.
|
148 |
-
gr.
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
download_output = gr.File(label="Download Processed Video", elem_id="download_output")
|
155 |
-
sentiment_output = gr.Markdown(label="Sentiment Scores", elem_id="sentiment_output")
|
156 |
submit_button.click(fn=display_results, inputs=[video_url, video_file, description], outputs=[video_output, download_output, sentiment_output])
|
157 |
|
158 |
demo.launch()
|
|
|
69 |
if not scenes:
|
70 |
return "No scenes detected", None, "No data"
|
71 |
|
72 |
+
best_scene_times, sentiments = analyze_scenes(video_path, scenes, description) # Updated to receive two values
|
73 |
+
if not best_scene_times:
|
74 |
+
return "No matching scene found", None, "No data"
|
75 |
+
|
76 |
+
final_clip = extract_best_scene(video_path, best_scene_times) # Unchanged usage of best_scene_times
|
77 |
if final_clip:
|
78 |
output_dir = "output"
|
79 |
os.makedirs(output_dir, exist_ok=True)
|
|
|
146 |
|
147 |
with gr.Blocks(theme=custom_theme, css=css) as demo:
|
148 |
with gr.Column():
|
149 |
+
gr.Markdown("# **Sickstadium AI**")
|
150 |
+
video_url = gr.Textbox(label="Video URL:")
|
151 |
+
video_file = gr.File(label="Upload Video File:", type="binary")
|
152 |
+
description = gr.Textbox(label="Describe your clip:")
|
153 |
+
submit_button = gr.Button("Process Video")
|
154 |
+
video_output = gr.Video(label="Processed Video")
|
155 |
+
download_output = gr.File(label="Download Processed Video")
|
156 |
+
sentiment_output = gr.Markdown(label="Sentiment Scores") # Using Markdown to display sentiment scores
|
|
|
|
|
157 |
submit_button.click(fn=display_results, inputs=[video_url, video_file, description], outputs=[video_output, download_output, sentiment_output])
|
158 |
|
159 |
demo.launch()
|