Spaces:
Sleeping
Sleeping
ACMCMC
commited on
Commit
·
2bb81aa
1
Parent(s):
9333b89
Final version
Browse files- Intersystems.ipynb +2 -6
- app.py +9 -2
- utils.py +1 -0
Intersystems.ipynb
CHANGED
|
@@ -55,14 +55,10 @@
|
|
| 55 |
]
|
| 56 |
},
|
| 57 |
{
|
| 58 |
-
"cell_type": "
|
| 59 |
-
"execution_count": 2,
|
| 60 |
"id": "95c000ff-bf0c-4489-8643-93a238db41dc",
|
| 61 |
"metadata": {},
|
| 62 |
-
"
|
| 63 |
-
"source": [
|
| 64 |
-
"os.environ['OPENAI_API_KEY']=\"sk-proj-CG2E98bSWs53X2eWO0Z4T3BlbkFJLm7H1vfkbua0zP548CKQ\""
|
| 65 |
-
]
|
| 66 |
},
|
| 67 |
{
|
| 68 |
"cell_type": "code",
|
|
|
|
| 55 |
]
|
| 56 |
},
|
| 57 |
{
|
| 58 |
+
"cell_type": "markdown",
|
|
|
|
| 59 |
"id": "95c000ff-bf0c-4489-8643-93a238db41dc",
|
| 60 |
"metadata": {},
|
| 61 |
+
"source": []
|
|
|
|
|
|
|
|
|
|
| 62 |
},
|
| 63 |
{
|
| 64 |
"cell_type": "code",
|
app.py
CHANGED
|
@@ -198,13 +198,16 @@ By minimizing this cost function, the model learns the embeddings of the entitie
|
|
| 198 |
"""
|
| 199 |
)
|
| 200 |
try:
|
|
|
|
| 201 |
edges_to_show = []
|
| 202 |
labels_of_diseases = get_labels_of_diseases_from_uris(
|
| 203 |
-
|
| 204 |
)
|
|
|
|
| 205 |
uris_and_labels_of_diseases = dict(
|
| 206 |
zip(df_similarities_augmented_set.index, labels_of_diseases)
|
| 207 |
)
|
|
|
|
| 208 |
color_mapper = matplotlib.cm.get_cmap("viridis")
|
| 209 |
for source in df_similarities_augmented_set.index:
|
| 210 |
for target in df_similarities_augmented_set.columns:
|
|
@@ -228,7 +231,8 @@ By minimizing this cost function, the model learns the embeddings of the entitie
|
|
| 228 |
nodes=[
|
| 229 |
Node(
|
| 230 |
id=disease,
|
| 231 |
-
|
|
|
|
| 232 |
size=50,
|
| 233 |
shape="circular",
|
| 234 |
)
|
|
@@ -293,6 +297,9 @@ with st.container():
|
|
| 293 |
render_trial_details(trials[i])
|
| 294 |
|
| 295 |
|
|
|
|
|
|
|
|
|
|
| 296 |
st.markdown(
|
| 297 |
"""This app has been created in HackUPC 2024 by the team 'Klìnic'. The team members are:
|
| 298 |
- [Aldan Creo](https://acmc-website.web.app)
|
|
|
|
| 198 |
"""
|
| 199 |
)
|
| 200 |
try:
|
| 201 |
+
print(f'df_similarities_augmented_set.index: {df_similarities_augmented_set.index}')
|
| 202 |
edges_to_show = []
|
| 203 |
labels_of_diseases = get_labels_of_diseases_from_uris(
|
| 204 |
+
augmented_set_of_diseases
|
| 205 |
)
|
| 206 |
+
print(f'labels_of_diseases: {labels_of_diseases}')
|
| 207 |
uris_and_labels_of_diseases = dict(
|
| 208 |
zip(df_similarities_augmented_set.index, labels_of_diseases)
|
| 209 |
)
|
| 210 |
+
print(f'uris_and_labels_of_diseases: {uris_and_labels_of_diseases}')
|
| 211 |
color_mapper = matplotlib.cm.get_cmap("viridis")
|
| 212 |
for source in df_similarities_augmented_set.index:
|
| 213 |
for target in df_similarities_augmented_set.columns:
|
|
|
|
| 231 |
nodes=[
|
| 232 |
Node(
|
| 233 |
id=disease,
|
| 234 |
+
# If it's nan then use the URI
|
| 235 |
+
label=uris_and_labels_of_diseases[disease] if (not pd.isna(uris_and_labels_of_diseases[disease]) and uris_and_labels_of_diseases[disease] != "nan") else disease,
|
| 236 |
size=50,
|
| 237 |
shape="circular",
|
| 238 |
)
|
|
|
|
| 297 |
render_trial_details(trials[i])
|
| 298 |
|
| 299 |
|
| 300 |
+
st.divider()
|
| 301 |
+
|
| 302 |
+
|
| 303 |
st.markdown(
|
| 304 |
"""This app has been created in HackUPC 2024 by the team 'Klìnic'. The team members are:
|
| 305 |
- [Aldan Creo](https://acmc-website.web.app)
|
utils.py
CHANGED
|
@@ -240,6 +240,7 @@ def get_labels_of_diseases_from_uris(uris: List[str]) -> List[str]:
|
|
| 240 |
SELECT label FROM Test.EntityEmbeddings
|
| 241 |
WHERE uri IN ({joined_uris})
|
| 242 |
"""
|
|
|
|
| 243 |
result = conn.execute(text(sql))
|
| 244 |
data = result.fetchall()
|
| 245 |
|
|
|
|
| 240 |
SELECT label FROM Test.EntityEmbeddings
|
| 241 |
WHERE uri IN ({joined_uris})
|
| 242 |
"""
|
| 243 |
+
print(text(sql))
|
| 244 |
result = conn.execute(text(sql))
|
| 245 |
data = result.fetchall()
|
| 246 |
|