Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -211,7 +211,7 @@ def get_drug_features_from_api(drug_name):
|
|
| 211 |
if 'Value' in info and 'StringWithMarkup' in info['Value']:
|
| 212 |
for text in info['Value']['StringWithMarkup']:
|
| 213 |
if 'String' in text:
|
| 214 |
-
features['route
|
| 215 |
break
|
| 216 |
|
| 217 |
if section['TOCHeading'] == 'half-life':
|
|
@@ -331,10 +331,10 @@ def predict_severity(drug1, drug2):
|
|
| 331 |
drug_features = {}
|
| 332 |
column_mappings = {
|
| 333 |
'SMILES': ['SMILES', 'smiles'],
|
| 334 |
-
'pharmacodynamics': ['
|
| 335 |
'toxicity': ['toxicity', 'Toxicity'],
|
| 336 |
'mechanism': ['mechanism', 'Mechanism'],
|
| 337 |
-
'
|
| 338 |
'route-of-elimination': ['route-of-elimination', 'Route-of-elimination'],
|
| 339 |
'half-life': ['half-life', 'Half-life']
|
| 340 |
}
|
|
@@ -349,7 +349,7 @@ def predict_severity(drug1, drug2):
|
|
| 349 |
break
|
| 350 |
except Exception as e:
|
| 351 |
print(f"Error accessing column {col}: {e}")
|
| 352 |
-
|
| 353 |
if not feature_found:
|
| 354 |
drug_features[feature] = 'No data'
|
| 355 |
|
|
@@ -440,7 +440,7 @@ def predict_severity(drug1, drug2):
|
|
| 440 |
|
| 441 |
if not is_from_dataset:
|
| 442 |
top_probs, top_indices = torch.topk(probabilities, 2, dim=1)
|
| 443 |
-
diff = top_probs[0][0]
|
| 444 |
if diff < 0.2 and top_indices[0][1] > top_indices[0][0]:
|
| 445 |
probabilities[0][top_indices[0][1]] *= 1.15
|
| 446 |
probabilities = probabilities / probabilities.sum()
|
|
|
|
| 211 |
if 'Value' in info and 'StringWithMarkup' in info['Value']:
|
| 212 |
for text in info['Value']['StringWithMarkup']:
|
| 213 |
if 'String' in text:
|
| 214 |
+
features['route-of-elimination'] = text['String'][:500]
|
| 215 |
break
|
| 216 |
|
| 217 |
if section['TOCHeading'] == 'half-life':
|
|
|
|
| 331 |
drug_features = {}
|
| 332 |
column_mappings = {
|
| 333 |
'SMILES': ['SMILES', 'smiles'],
|
| 334 |
+
'pharmacodynamics': ['pharmacodynamics', 'Pharmacodynamics', 'pharmacology'],
|
| 335 |
'toxicity': ['toxicity', 'Toxicity'],
|
| 336 |
'mechanism': ['mechanism', 'Mechanism'],
|
| 337 |
+
'met/nullabolism': ['metabolism', 'Metabolism'],
|
| 338 |
'route-of-elimination': ['route-of-elimination', 'Route-of-elimination'],
|
| 339 |
'half-life': ['half-life', 'Half-life']
|
| 340 |
}
|
|
|
|
| 349 |
break
|
| 350 |
except Exception as e:
|
| 351 |
print(f"Error accessing column {col}: {e}")
|
| 352 |
+
continue
|
| 353 |
if not feature_found:
|
| 354 |
drug_features[feature] = 'No data'
|
| 355 |
|
|
|
|
| 440 |
|
| 441 |
if not is_from_dataset:
|
| 442 |
top_probs, top_indices = torch.topk(probabilities, 2, dim=1)
|
| 443 |
+
diff = top_probs[0][0].item() - top_probs[0][1].item()
|
| 444 |
if diff < 0.2 and top_indices[0][1] > top_indices[0][0]:
|
| 445 |
probabilities[0][top_indices[0][1]] *= 1.15
|
| 446 |
probabilities = probabilities / probabilities.sum()
|