Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -77,7 +77,7 @@ def display_results(video_url, video_file, description):
|
|
77 |
final_clip_path = os.path.join(output_dir, f"{uuid.uuid4()}_final_clip.mp4")
|
78 |
final_clip.write_videofile(final_clip_path, codec='libx264', audio_codec='aac')
|
79 |
cleanup_temp_files()
|
80 |
-
sentiment_display = "\n".join(f"{k}
|
81 |
return final_clip_path, final_clip_path, sentiment_display
|
82 |
else:
|
83 |
return "No matching scene found", None, "No data"
|
@@ -152,7 +152,7 @@ with gr.Blocks(theme=custom_theme, css=css) as demo:
|
|
152 |
submit_button = gr.Button("Process Video", elem_id="submit_button")
|
153 |
video_output = gr.Video(label="Processed Video", elem_id="video_output")
|
154 |
download_output = gr.File(label="Download Processed Video", elem_id="download_output")
|
155 |
-
sentiment_output = gr.
|
156 |
submit_button.click(fn=display_results, inputs=[video_url, video_file, description], outputs=[video_output, download_output, sentiment_output])
|
157 |
|
158 |
demo.launch()
|
|
|
77 |
final_clip_path = os.path.join(output_dir, f"{uuid.uuid4()}_final_clip.mp4")
|
78 |
final_clip.write_videofile(final_clip_path, codec='libx264', audio_codec='aac')
|
79 |
cleanup_temp_files()
|
80 |
+
sentiment_display = "\n".join(f"**{k}:** {v:.2f}%" for k, v in sentiments.items()) # Format sentiment data for Markdown
|
81 |
return final_clip_path, final_clip_path, sentiment_display
|
82 |
else:
|
83 |
return "No matching scene found", None, "No data"
|
|
|
152 |
submit_button = gr.Button("Process Video", elem_id="submit_button")
|
153 |
video_output = gr.Video(label="Processed Video", elem_id="video_output")
|
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()
|