ManishThota commited on
Commit
9399086
·
verified ·
1 Parent(s): 72c6296

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -14
app.py CHANGED
@@ -39,20 +39,26 @@ def process_video_and_questions(video, standing, hands, location, screen):
39
  response = describe_video(video, final_prompt)
40
  final_response = f"<video_name>{video_name}</video_name>" + " \n" + response
41
 
42
- print(final_response)
43
- print()
44
- print(f"final response type: {type(final_response)}")
45
-
46
- if standing == False:
47
- final_response = final_response.replace('standing: 1', 'standing: None')
48
- elif hands == False:
49
- final_response = final_response.replace('hands.free: 1', 'hands.free: None')
50
- elif location == False:
51
- final_response = final_response.replace('indoors: 1', 'indoors: None')
52
- elif screen == False:
53
- final_response = final_response.replace('screen.interaction_yes: 1', 'screen.interaction_yes: None')
54
-
55
- print(final_response)
 
 
 
 
 
 
56
 
57
  return final_response
58
 
 
39
  response = describe_video(video, final_prompt)
40
  final_response = f"<video_name>{video_name}</video_name>" + " \n" + response
41
 
42
+ conditions = {
43
+ 'standing': (standing, 'standing: 1', 'standing: None'),
44
+ 'hands': (hands, 'hands.free: 1', 'hands.free: None'),
45
+ 'location': (location, 'indoors: 1', 'indoors: None'),
46
+ 'screen': (screen, 'screen.interaction_yes: 1', 'screen.interaction_yes: None')
47
+ }
48
+
49
+ for key, (condition, to_replace, replacement) in conditions.items():
50
+ if not condition:
51
+ final_response = final_response.replace(to_replace, replacement)
52
+
53
+ # if standing == False:
54
+ # final_response = final_response.replace('standing: 1', 'standing: None')
55
+ # elif hands == False:
56
+ # final_response = final_response.replace('hands.free: 1', 'hands.free: None')
57
+ # elif location == False:
58
+ # final_response = final_response.replace('indoors: 1', 'indoors: None')
59
+ # elif screen == False:
60
+ # final_response = final_response.replace('screen.interaction_yes: 1', 'screen.interaction_yes: None')
61
+
62
 
63
  return final_response
64