Spaces:
Sleeping
Sleeping
File size: 653 Bytes
ffbf761 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
import json
from typing import Optional, Dict, Any, List, Tuple
def load_simulation_data(file) -> Tuple[Optional[List[Dict[str, Any]]], Optional[List[str]]]:
if file is None:
return None, None
try:
json_data = json.load(open(file.name))
simulations = json_data['simulations']
descriptions = [
f"Simulation {i}: {len(sim['subjects'])} subjects, {len(sim['instructions'])} instructions"
for i, sim in enumerate(simulations)
]
return simulations, descriptions
except Exception as e:
print(f"Error loading simulation data: {str(e)}")
return None, None
|