Spaces:
Runtime error
Runtime error
ManishThota
commited on
Update app.py
Browse files
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 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
|