ManasSharma07 commited on
Commit
b183f17
·
verified ·
1 Parent(s): 5cd6129

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +16 -2
src/streamlit_app.py CHANGED
@@ -14,13 +14,23 @@ from mace.calculators import mace_mp
14
  from fairchem.core import pretrained_mlip, FAIRChemCalculator
15
  from orb_models.forcefield import pretrained
16
  from orb_models.forcefield.calculator import ORBCalculator
17
- #from mattersim.forcefield import MatterSimCalculator
18
  import pandas as pd
19
  import yaml # Added for FairChem reference energies
20
  import subprocess
21
  import sys
22
  import pkg_resources
23
 
 
 
 
 
 
 
 
 
 
 
 
24
  # Define version threshold
25
  required_version = "2.0.0"
26
 
@@ -35,6 +45,7 @@ except pkg_resources.DistributionNotFound:
35
  print("numpy is not installed. Installing numpy<2.0.0...")
36
  subprocess.check_call([sys.executable, "-m", "pip", "install", "numpy<2.0.0"])
37
 
 
38
  from huggingface_hub import login
39
 
40
  # try:
@@ -777,7 +788,10 @@ if atoms is not None:
777
 
778
 
779
  st.sidebar.markdown("## Model Selection")
780
- model_type = st.sidebar.radio("Select Model Type:", ["MACE", "FairChem", "ORB"])
 
 
 
781
 
782
  selected_task_type = None # For FairChem UMA
783
  if model_type == "MACE":
 
14
  from fairchem.core import pretrained_mlip, FAIRChemCalculator
15
  from orb_models.forcefield import pretrained
16
  from orb_models.forcefield.calculator import ORBCalculator
 
17
  import pandas as pd
18
  import yaml # Added for FairChem reference energies
19
  import subprocess
20
  import sys
21
  import pkg_resources
22
 
23
+ try:
24
+ subprocess.check_call([sys.executable, "-m", "pip", "install", "mattersim"])
25
+ except Exception as e:
26
+ print(f"Error during installation of mattersim: {e}")
27
+
28
+ try:
29
+ from mattersim.forcefield import MatterSimCalculator
30
+ mattersim_available = True
31
+ except ImportError as e:
32
+ print(f"Failed to import MatterSimCalculator: {e}")
33
+ mattersim_available = False
34
  # Define version threshold
35
  required_version = "2.0.0"
36
 
 
45
  print("numpy is not installed. Installing numpy<2.0.0...")
46
  subprocess.check_call([sys.executable, "-m", "pip", "install", "numpy<2.0.0"])
47
 
48
+
49
  from huggingface_hub import login
50
 
51
  # try:
 
788
 
789
 
790
  st.sidebar.markdown("## Model Selection")
791
+ if mattersim_available:
792
+ model_type = st.sidebar.radio("Select Model Type:", ["MACE", "FairChem", "ORB", "MatterSim"])
793
+ else:
794
+ model_type = st.sidebar.radio("Select Model Type:", ["MACE", "FairChem", "ORB"])
795
 
796
  selected_task_type = None # For FairChem UMA
797
  if model_type == "MACE":