Spaces:
Sleeping
Sleeping
improve instruction description
Browse files- data/loader.py +23 -5
data/loader.py
CHANGED
@@ -3,12 +3,30 @@ from typing import Optional, Dict, Any, List, Tuple
|
|
3 |
|
4 |
|
5 |
def create_instruction_description(instruction: Dict[str, Any]) -> str:
|
6 |
-
|
7 |
-
shot_type = instruction.get('initialShotType', 'N/A')
|
8 |
-
frames = instruction.get('frameCount', 'N/A')
|
9 |
-
subject_idx = instruction.get('subjectIndex', 'N/A')
|
10 |
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
|
14 |
def load_simulation_data(file) -> Tuple[Optional[List[Dict[str, Any]]], Optional[List[str]]]:
|
|
|
3 |
|
4 |
|
5 |
def create_instruction_description(instruction: Dict[str, Any]) -> str:
|
6 |
+
parts = []
|
|
|
|
|
|
|
7 |
|
8 |
+
movement = instruction.get('cameraMovement')
|
9 |
+
shot_type = instruction.get('initialShotType')
|
10 |
+
frames = instruction.get('frameCount')
|
11 |
+
subject_idx = instruction.get('subjectIndex')
|
12 |
+
|
13 |
+
if movement and shot_type:
|
14 |
+
parts.append(f"{movement} {shot_type}")
|
15 |
+
elif movement:
|
16 |
+
parts.append(f"{movement} shot")
|
17 |
+
elif shot_type:
|
18 |
+
parts.append(f"Static {shot_type}")
|
19 |
+
|
20 |
+
if subject_idx is not None:
|
21 |
+
parts.append(f"of subject {subject_idx}")
|
22 |
+
|
23 |
+
if frames is not None:
|
24 |
+
parts.append(f"lasting {frames} frames")
|
25 |
+
|
26 |
+
if not parts:
|
27 |
+
return "No camera instruction details available"
|
28 |
+
|
29 |
+
return " ".join(parts)
|
30 |
|
31 |
|
32 |
def load_simulation_data(file) -> Tuple[Optional[List[Dict[str, Any]]], Optional[List[str]]]:
|