ManishThota commited on
Commit
9101cbf
·
verified ·
1 Parent(s): d665ebe

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -9
app.py CHANGED
@@ -12,26 +12,18 @@ def process_video_and_questions(video, standing, hands, location, screen):
12
  # Extract the video name (filename)
13
  video_name = os.path.basename(video)
14
 
15
- standing_flag = None
16
- hands_flag = None
17
- location_flag = None
18
- screen_flag = None
19
 
20
  # Construct the query with the video name included
21
  query = f"Answer the questions from the video\n"
22
  additional_info = []
23
  if standing:
24
  additional_info.append("Is the subject in the video standing or sitting?\n")
25
- standing_flag = True
26
  if hands:
27
  additional_info.append("Is the subject holding any object in their hands?\n")
28
- hands_flag = True
29
  if location:
30
  additional_info.append("Is the subject present indoors?\n")
31
- location_flag = True
32
  if screen:
33
  additional_info.append("Is the subject interacting with a screen in the background by facing the screen?\n")
34
- screen_flag = True
35
 
36
  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\n:
37
  <annotation>indoors: 0</annotation>
@@ -51,8 +43,14 @@ def process_video_and_questions(video, standing, hands, location, screen):
51
  print()
52
  print(f"final response type: {type(final_response)}")
53
 
54
- if standing_flag == None:
55
  final_response.replace('standing: 1', 'standing: None')
 
 
 
 
 
 
56
 
57
  print(final_response)
58
 
 
12
  # Extract the video name (filename)
13
  video_name = os.path.basename(video)
14
 
 
 
 
 
15
 
16
  # Construct the query with the video name included
17
  query = f"Answer the questions from the video\n"
18
  additional_info = []
19
  if standing:
20
  additional_info.append("Is the subject in the video standing or sitting?\n")
 
21
  if hands:
22
  additional_info.append("Is the subject holding any object in their hands?\n")
 
23
  if location:
24
  additional_info.append("Is the subject present indoors?\n")
 
25
  if screen:
26
  additional_info.append("Is the subject interacting with a screen in the background by facing the screen?\n")
 
27
 
28
  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\n:
29
  <annotation>indoors: 0</annotation>
 
43
  print()
44
  print(f"final response type: {type(final_response)}")
45
 
46
+ if standing == False:
47
  final_response.replace('standing: 1', 'standing: None')
48
+ elif hands == False:
49
+ final_response.replace('hands.free: 1', 'hands.free: None')
50
+ elif location == False:
51
+ final_response.replace('indoors: 1', 'indoors: None')
52
+ elif screen == False:
53
+ final_response.replace('screen.interaction_yes: 1', 'screen.interaction_yes: None')
54
 
55
  print(final_response)
56