Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -23,10 +23,10 @@ def find_qsar_guid_from_prompt(prompt: str, qsar_guid_index: int) -> str:
|
|
| 23 |
qsar_guid_index: The qsar guid index to select given the prompt that the user gave, so if the user asks for solubility, the qsar guid should be possible_qsar_guids[0].key
|
| 24 |
"""
|
| 25 |
|
| 26 |
-
return possible_qsar_guids[qsar_guid_index]
|
| 27 |
|
| 28 |
@tool
|
| 29 |
-
def qsartoolbox_qsar_model_tool(smiles:str, qsarModelGUID: str)-> str:
|
| 30 |
"""This machine learning model serves as an interface for the QSAR Toolbox API,
|
| 31 |
allowing users to input SMILES strings and select a QSAR model to generate predictive values for various properties.
|
| 32 |
|
|
@@ -35,7 +35,13 @@ def qsartoolbox_qsar_model_tool(smiles:str, qsarModelGUID: str)-> str:
|
|
| 35 |
qsarModelGUID: a qsar model guid to use
|
| 36 |
"""
|
| 37 |
|
| 38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
|
| 40 |
final_answer = FinalAnswerTool()
|
| 41 |
|
|
|
|
| 23 |
qsar_guid_index: The qsar guid index to select given the prompt that the user gave, so if the user asks for solubility, the qsar guid should be possible_qsar_guids[0].key
|
| 24 |
"""
|
| 25 |
|
| 26 |
+
return possible_qsar_guids[qsar_guid_index]['key']
|
| 27 |
|
| 28 |
@tool
|
| 29 |
+
def qsartoolbox_qsar_model_tool(smiles:str, qsarModelGUID: str)-> Optional[str]:
|
| 30 |
"""This machine learning model serves as an interface for the QSAR Toolbox API,
|
| 31 |
allowing users to input SMILES strings and select a QSAR model to generate predictive values for various properties.
|
| 32 |
|
|
|
|
| 35 |
qsarModelGUID: a qsar model guid to use
|
| 36 |
"""
|
| 37 |
|
| 38 |
+
results = jaqpot.qsartoolbox_qsar_model_predict_sync(smiles, qsarModelGUID)
|
| 39 |
+
result = next((x for x in results if x["Value"] != ''), None)
|
| 40 |
+
|
| 41 |
+
if(result != None):
|
| 42 |
+
return result['Value']
|
| 43 |
+
else
|
| 44 |
+
return None
|
| 45 |
|
| 46 |
final_answer = FinalAnswerTool()
|
| 47 |
|