ManishThota commited on
Commit
549eba8
·
verified ·
1 Parent(s): 2a2b9f5

Update multi_video_app.py

Browse files
Files changed (1) hide show
  1. multi_video_app.py +10 -9
multi_video_app.py CHANGED
@@ -33,18 +33,18 @@ def save_to_csv(observations: List[Dict], output_dir: str = "outputs") -> str:
33
  return csv_file
34
 
35
  # Function to process a single video and return the observation data
36
- def process_single_video(video_path: str, sitting, hands, location, screen) -> Dict:
37
  video_name = os.path.basename(video_path) # Extract video name from the path
38
  query = "Describe this video in detail and answer the questions"
39
  additional_info = []
40
- if sitting:
41
- additional_info.append("Is the subject in the video standing or sitting?")
42
  if hands:
43
- additional_info.append("Is the subject holding any object in their hands, if so the hands are not free else they are free?")
44
  if location:
45
- additional_info.append("Is the subject present indoors or outdoors?")
46
  if screen:
47
- additional_info.append("Is the subject interacting with a screen in the background by facing the screen?")
48
 
49
  end_query = """Provide the results in <annotation> tags, where 0 indicates False, 1 indicates True, and None indicates that no information is present. Follow the below examples:
50
  <annotation>indoors: 0</annotation>
@@ -59,6 +59,7 @@ def process_single_video(video_path: str, sitting, hands, location, screen) -> D
59
  # Assuming your describe_video function handles the video processing
60
  final_response = describe_video(video_path, final_prompt)
61
 
 
62
  conditions = {
63
  'standing': (standing, 'standing: 1', 'standing: None'),
64
  'hands': (hands, 'hands.free: 1', 'hands.free: None'),
@@ -98,9 +99,9 @@ def gradio_interface(video_files, sitting, hands, location, screen):
98
 
99
  # Inputs
100
  video_files = gr.File(file_count="multiple", file_types=["video"], label="Upload multiple videos")
101
- sitting = gr.Checkbox(label="Sitting/Standing")
102
- hands = gr.Checkbox(label="Hands Free/Not Free")
103
- location = gr.Checkbox(label="Indoors/Outdoors")
104
  screen = gr.Checkbox(label="Screen Interaction")
105
 
106
  # Outputs
 
33
  return csv_file
34
 
35
  # Function to process a single video and return the observation data
36
+ def process_single_video(video_path: str, standing, hands, location, screen) -> Dict:
37
  video_name = os.path.basename(video_path) # Extract video name from the path
38
  query = "Describe this video in detail and answer the questions"
39
  additional_info = []
40
+ if standing:
41
+ additional_info.append("Is the subject in the video standing or sitting?\n")
42
  if hands:
43
+ additional_info.append("Is the subject holding any object in their hands?\n")
44
  if location:
45
+ additional_info.append("Is the subject present indoors?\n")
46
  if screen:
47
+ additional_info.append("Is the subject interacting with a screen in the background by facing the screen?\n")
48
 
49
  end_query = """Provide the results in <annotation> tags, where 0 indicates False, 1 indicates True, and None indicates that no information is present. Follow the below examples:
50
  <annotation>indoors: 0</annotation>
 
59
  # Assuming your describe_video function handles the video processing
60
  final_response = describe_video(video_path, final_prompt)
61
 
62
+
63
  conditions = {
64
  'standing': (standing, 'standing: 1', 'standing: None'),
65
  'hands': (hands, 'hands.free: 1', 'hands.free: None'),
 
99
 
100
  # Inputs
101
  video_files = gr.File(file_count="multiple", file_types=["video"], label="Upload multiple videos")
102
+ standing = gr.Checkbox(label="Standing")
103
+ hands = gr.Checkbox(label="Hands Free")
104
+ location = gr.Checkbox(label="Indoors")
105
  screen = gr.Checkbox(label="Screen Interaction")
106
 
107
  # Outputs