zulissimeta commited on
Commit
c37b546
·
1 Parent(s): 8c6ac66

fix logic for uploaded structures

Browse files
Files changed (1) hide show
  1. simulation_scripts.py +6 -1
simulation_scripts.py CHANGED
@@ -42,7 +42,9 @@ MAX_ATOMS = os.environ.get("MAX_ATOMS", 2000)
42
  INFERENCE_ENDPOINT_URL = os.environ["INFERENCE_ENDPOINT_URL"]
43
 
44
 
45
- def validate_ase_atoms_and_login(structure_file, login_button_value):
 
 
46
  # Validate and write the uploaded file content
47
  if not structure_file:
48
  return (
@@ -51,6 +53,9 @@ def validate_ase_atoms_and_login(structure_file, login_button_value):
51
  "Missing input structure!",
52
  )
53
 
 
 
 
54
  try:
55
  atoms = ase.io.read(structure_file)
56
  except Exception as e:
 
42
  INFERENCE_ENDPOINT_URL = os.environ["INFERENCE_ENDPOINT_URL"]
43
 
44
 
45
+ def validate_ase_atoms_and_login(
46
+ structure_file: dict | str, login_button_value: str
47
+ ) -> tuple[gr.Button, gr.Button, str]:
48
  # Validate and write the uploaded file content
49
  if not structure_file:
50
  return (
 
53
  "Missing input structure!",
54
  )
55
 
56
+ if isinstance(structure_file, dict):
57
+ structure_file = structure_file["path"]
58
+
59
  try:
60
  atoms = ase.io.read(structure_file)
61
  except Exception as e: