How to run this route from Python with the Ouro SDK.
API access requires an API key. Create one in Settings → API Keys, then set OURO_API_KEY in your environment. Install the SDK with pip install ouro-py.
POST /alignn/predictParameters and request body schema for this route.
jv_formation_energy_peratom_alignnjv_optb88vdw_total_energy_alignnjv_ehull_alignnmp_e_form_alignnjv_optb88vdw_bandgap_alignnjv_mbj_bandgap_alignnmp_gappbe_alignnjv_spillage_alignnjv_slme_alignnjv_avg_elec_mass_alignnjv_avg_hole_mass_alignnintermat_cbmintermat_vbmintermat_phijv_epsx_alignnjv_mepsx_alignnjv_dfpt_piezo_max_dielectric_alignnjv_dfpt_piezo_max_dij_alignnjv_bulk_modulus_kv_alignnjv_shear_modulus_gv_alignnjv_exfoliation_energy_alignnjv_n-Seebeck_alignnjv_p-Seebeck_alignnjv_n-powerfact_alignnjv_magmom_oszicar_alignnjv_max_efg_alignnjv_supercon_tc_alignnjv_supercon_edos_alignnjv_supercon_debye_alignnjv_supercon_a2F_alignnjv_pdos_alignnjv_kpoint_length_unit_alignntinnet_O_alignntinnet_N_alignntinnet_OH_alignnAGRA_O_alignnAGRA_OH_alignnAGRA_CHO_alignnAGRA_CO_alignnAGRA_COOH_alignnocp2020_allocp2020_100kocp2020_10kqm9_U0_alignnqm9_U_alignnqm9_alpha_alignnqm9_gap_alignnqm9_G_alignnqm9_HOMO_alignnqm9_LUMO_alignnqm9_ZPVE_alignnhmof_co2_absp_alignnhmof_max_co2_adsp_alignnhmof_surface_area_m2g_alignnhmof_surface_area_m2cm3_alignnhmof_pld_alignnhmof_lcd_alignnhmof_void_fraction_alignnALIGNN pretrained model key (e.g. jv_formation_energy_peratom_alignn) or slug (e.g. formation-energy). See GET /alignn/models for all options.
Pass the ID of an Ouro asset for each of these in input_assets. Ouro loads the asset and sends it to the route.
execute returns an action: the record of this run, with its status, response, and any assets it created.
To avoid blocking on a slow run, start it without waiting and collect the result later.
By default a failed run comes back as an action with status error. Pass raise_on_error=True to raise an exception instead.
Every run is saved as an action. List yours, or read the logs of a single run. See the Python SDK reference for everything an action carries.
import os
from ouro import Ouro
ouro = Ouro(api_key=os.environ.get("OURO_API_KEY"))
# The ID also works, and stays the same if the route is renamed: "de2d96c5-b638-46c2-82f5-cae72aa4383c"
route = ouro.routes.retrieve("mmoderwell/predict-a-crystal-property-with-alignn")
action = route.execute(
body={
"model": "jv_formation_energy_peratom_alignn",
},
input_assets={
"file": "your-file-id",
},
)
print(action.status) # "success" or "error"
print(action.final_data)# Returns as soon as the run is accepted
action = route.execute(
body={
"model": "jv_formation_energy_peratom_alignn",
},
input_assets={
"file": "your-file-id",
},
wait=False,
)
print(action.id, action.status)
# Later, even from another process
action = ouro.routes.poll_action(str(action.id), poll_interval=5, timeout=1800)
print(action.final_data)from ouro import ExternalServiceError, RouteExecutionError
try:
action = route.execute(
body={
"model": "jv_formation_energy_peratom_alignn",
},
input_assets={
"file": "your-file-id",
},
raise_on_error=True,
)
except ExternalServiceError as exc:
# The API behind this route failed
print(exc.status_code, exc.retryable)
except RouteExecutionError as exc:
print(exc.action_id, exc.status, exc.response)
except TimeoutError as exc:
# Still running on Ouro; pick it up again later
action = ouro.routes.poll_action(exc.action_id, timeout=None)route = ouro.routes.retrieve("mmoderwell/predict-a-crystal-property-with-alignn")
# Your runs of this route
actions = route.read_actions()
for action in actions:
print(action.id, action.status, action.created_at)
# One run and its logs
action = ouro.routes.retrieve_action("your-action-id")
for entry in action.read_logs(chronological=True):
print(entry.level, entry.message)Run an ALIGNN pretrained model on a CIF structure. Set model to a model key or slug from GET /alignn/models.
Execution
Usage
1981 callsView history