Spaces:
Runtime error
Runtime error
Download frontend/src/api/tools.ts from SII-gelingli/echem-agent: direct link, hf CLI and curl.
- Browser
- Download file 1.74 kB
-
https://huggingface.co/spaces/SII-gelingli/echem-agent/resolve/main/frontend/src/api/tools.ts
- Command line
-
hf download hf://spaces/SII-gelingli/echem-agent/frontend/src/api/tools.ts
-
curl -L -o tools.ts https://huggingface.co/spaces/SII-gelingli/echem-agent/resolve/main/frontend/src/api/tools.ts
1.74 kB
| import apiClient from './client'; | |
| export async function validateSmiles(smilesList: string[]) { | |
| const res = await apiClient.post('/tools/validate-smiles', { smiles_list: smilesList }); | |
| return res.data; | |
| } | |
| export async function parseReaction(reactionSmiles: string) { | |
| const res = await apiClient.post('/tools/parse-reaction', { reaction_smiles: reactionSmiles }); | |
| return res.data; | |
| } | |
| export async function recommendConditions(reactionSmiles: string, topK = 3) { | |
| const res = await apiClient.post('/tools/recommend-conditions', { | |
| reaction_smiles: reactionSmiles, | |
| top_k: topK, | |
| }); | |
| return res.data; | |
| } | |
| export async function generateCVAE( | |
| reactionSmiles: string, | |
| numSamples = 10, | |
| temperature = 1.0, | |
| topK = 3, | |
| ) { | |
| const res = await apiClient.post('/tools/generate-cvae', { | |
| reaction_smiles: reactionSmiles, | |
| num_samples: numSamples, | |
| temperature, | |
| top_k: topK, | |
| }); | |
| return res.data; | |
| } | |
| export async function predictYield( | |
| reactionSmiles: string, | |
| conditions: Array<{ | |
| solvent_smiles: string; | |
| electrolyte_smiles: string; | |
| anode_index?: number; | |
| cathode_index?: number; | |
| cell_type_index?: number; | |
| }>, | |
| ) { | |
| const res = await apiClient.post('/tools/predict-yield', { | |
| reaction_smiles: reactionSmiles, | |
| conditions, | |
| }); | |
| return res.data; | |
| } | |
| export async function searchSimilar(reactionSmiles: string, topK = 5, threshold = 0.3) { | |
| const res = await apiClient.post('/tools/search-similar', { | |
| reaction_smiles: reactionSmiles, | |
| top_k: topK, | |
| threshold, | |
| }); | |
| return res.data; | |
| } | |
| export function getMoleculeRenderUrl(smiles: string, width = 300, height = 200) { | |
| return `/api/molecules/render?smiles=${encodeURIComponent(smiles)}&width=${width}&height=${height}`; | |
| } | |