NikhilJoson commited on
Commit
0ba7a8a
Β·
verified Β·
1 Parent(s): e46cc89

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -5
app.py CHANGED
@@ -244,10 +244,13 @@ def process_video(video_file):
244
 
245
  # Step 2: Generate embeddings (GPU operation)
246
  status_msg += "\nπŸ”„ Generating embeddings for video clips..."
247
- embeddings = gpu_operation("generate_embeddings", clip_paths) # This now generates embeddings on GPU
248
 
249
- if isinstance(embeddings, str) and "❌" in embeddings: # Check for errors during embedding
250
- return embeddings, clips_info, [], [] # Return error message, clips_info, empty embeddings and clip_paths
 
 
 
251
 
252
  status_msg += f"\nβœ… Generated embeddings for {len(embeddings)} clips"
253
  status_msg += "\n🎯 Ready for queries!"
@@ -262,9 +265,9 @@ def search_video_clips(query, video_embeddings_state, video_clips_state):
262
 
263
  # Create Gradio interface
264
  def create_interface():
265
- with gr.Blocks(title="Security Camera AI Assistant", theme=gr.themes.Soft()) as demo:
266
  gr.Markdown("# πŸŽ₯ Security Camera AI Assistant")
267
- gr.Markdown("Upload security footage. Then search through the video using natural language queries to get relevant clips with precise timestamps!!")
268
 
269
  with gr.Row():
270
  with gr.Column(scale=1):
 
244
 
245
  # Step 2: Generate embeddings (GPU operation)
246
  status_msg += "\nπŸ”„ Generating embeddings for video clips..."
247
+ embeddings_result = gpu_operation("generate_embeddings", clip_paths)
248
 
249
+ # Check if embeddings_result is an error tuple (string, list)
250
+ if isinstance(embeddings_result, tuple) and len(embeddings_result) == 2 and isinstance(embeddings_result[0], str) and "❌" in embeddings_result[0]:
251
+ return embeddings_result[0], clips_info, [], [] # Return error message
252
+
253
+ embeddings = embeddings_result # Assign actual embeddings
254
 
255
  status_msg += f"\nβœ… Generated embeddings for {len(embeddings)} clips"
256
  status_msg += "\n🎯 Ready for queries!"
 
265
 
266
  # Create Gradio interface
267
  def create_interface():
268
+ with gr.Blocks(title="Security Camera AI Assistant", theme=gr.themes.Ocean()) as demo:
269
  gr.Markdown("# πŸŽ₯ Security Camera AI Assistant")
270
+ gr.Markdown("Upload a video.Then search sing natural language queries, to get relevant clips with precise timestamps!!")
271
 
272
  with gr.Row():
273
  with gr.Column(scale=1):