jschwab21 commited on
Commit
e5facda
·
verified ·
1 Parent(s): 943941c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -12
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
- best_scene, sentiments = analyze_scenes(video_path, scenes, description) # Ensure this function also returns sentiment data
73
- final_clip = extract_best_scene(video_path, best_scene)
 
 
 
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**", elem_classes="centered-markdown", elem_id="sickstadium-title")
147
- gr.Markdown("### Upload your videos. Find sick clips. Tell your truth.", elem_classes="centered-markdown")
148
- gr.Markdown("**Welcome to Sickstadium AI. Our goal is to empower content creators with the ability to tell their stories without the friction of traditional video editing software. Skip the timeline, and don't worry about your video editing skills. Upload your video, describe the clip you want, and let our AI video editor do the work for you. Get more info about the Sickstadium project at [Strongholdlabs.io](https://strongholdlabs.io/)**", elem_classes="centered-markdown")
149
- video_url = gr.Textbox(label="Video URL:", elem_id="video_url")
150
- video_file = gr.File(label="Upload Video File:", elem_id="video_file", interactive=True, file_types=["video"], type="binary")
151
- description = gr.Textbox(label="Describe your clip:", elem_id="description")
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()
 
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()