Spaces:
Running
Running
update
Browse files
app.py
CHANGED
|
@@ -32,6 +32,8 @@ def run_inference(
|
|
| 32 |
# Read SMILES
|
| 33 |
if smiles is None and smiles_path is None:
|
| 34 |
raise TypeError("Pass either single SMILES or a file")
|
|
|
|
|
|
|
| 35 |
elif smiles is not None:
|
| 36 |
smiles = [smiles]
|
| 37 |
elif smiles_path is not None:
|
|
@@ -47,10 +49,8 @@ def run_inference(
|
|
| 47 |
else:
|
| 48 |
omic_path = None
|
| 49 |
|
| 50 |
-
|
| 51 |
-
results = []
|
| 52 |
for smi in tqdm(smiles, total=len(smiles)):
|
| 53 |
-
result = pd.DataFrame({})
|
| 54 |
output = submission(
|
| 55 |
drug={"smiles": smi},
|
| 56 |
workspace_id="emulated_workspace_id",
|
|
@@ -71,8 +71,7 @@ def run_inference(
|
|
| 71 |
result[f"epistemic_confidence_{smi}"] = (
|
| 72 |
output["aleatoric_confidence"].squeeze().round(3)
|
| 73 |
)
|
| 74 |
-
|
| 75 |
-
predicted_df = pd.concat(results)
|
| 76 |
|
| 77 |
# Prepare DF to visualize
|
| 78 |
if omic_path is None:
|
|
@@ -105,10 +104,6 @@ def run_inference(
|
|
| 105 |
# Save to temporary dir
|
| 106 |
temp_path = os.path.join(tempfile.gettempdir(), "paccmann_result.csv")
|
| 107 |
result_df.to_csv(temp_path)
|
| 108 |
-
print("OUTPUT", result_df.columns)
|
| 109 |
-
print(result_df.head(2))
|
| 110 |
-
print()
|
| 111 |
-
print(result_df)
|
| 112 |
|
| 113 |
return temp_path, result_df.head(25)
|
| 114 |
|
|
|
|
| 32 |
# Read SMILES
|
| 33 |
if smiles is None and smiles_path is None:
|
| 34 |
raise TypeError("Pass either single SMILES or a file")
|
| 35 |
+
elif smiles is not None and smiles_path is not None:
|
| 36 |
+
raise TypeError("Pass either single SMILES or a file, not both")
|
| 37 |
elif smiles is not None:
|
| 38 |
smiles = [smiles]
|
| 39 |
elif smiles_path is not None:
|
|
|
|
| 49 |
else:
|
| 50 |
omic_path = None
|
| 51 |
|
| 52 |
+
result = pd.DataFrame({})
|
|
|
|
| 53 |
for smi in tqdm(smiles, total=len(smiles)):
|
|
|
|
| 54 |
output = submission(
|
| 55 |
drug={"smiles": smi},
|
| 56 |
workspace_id="emulated_workspace_id",
|
|
|
|
| 71 |
result[f"epistemic_confidence_{smi}"] = (
|
| 72 |
output["aleatoric_confidence"].squeeze().round(3)
|
| 73 |
)
|
| 74 |
+
predicted_df = result
|
|
|
|
| 75 |
|
| 76 |
# Prepare DF to visualize
|
| 77 |
if omic_path is None:
|
|
|
|
| 104 |
# Save to temporary dir
|
| 105 |
temp_path = os.path.join(tempfile.gettempdir(), "paccmann_result.csv")
|
| 106 |
result_df.to_csv(temp_path)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 107 |
|
| 108 |
return temp_path, result_df.head(25)
|
| 109 |
|