Spaces:
Sleeping
Sleeping
ACMCMC
commited on
Commit
•
3cfdd19
1
Parent(s):
9373d80
UI changes
Browse files
app.py
CHANGED
@@ -38,12 +38,13 @@ engine = create_engine(CONNECTION_STRING)
|
|
38 |
|
39 |
st.image("img_klinic.jpeg", caption="(AI-generated image)", use_column_width=True)
|
40 |
st.title("Klìnic", help="AI-powered clinical trial search engine")
|
|
|
41 |
|
42 |
with st.container(): # user input
|
43 |
col1, col2 = st.columns((6, 1))
|
44 |
|
45 |
with col1:
|
46 |
-
description_input = st.text_area(label="Enter
|
47 |
|
48 |
with col2:
|
49 |
st.text('') # dummy to center vertically
|
@@ -98,6 +99,16 @@ with st.container():
|
|
98 |
# graph
|
99 |
with st.container():
|
100 |
if show_graph:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
# TODO actual graph
|
102 |
graph_of_diseases = agraph(
|
103 |
nodes=[
|
@@ -179,4 +190,4 @@ with st.container():
|
|
179 |
|
180 |
for i in range(0, len(tabs)):
|
181 |
with tabs[i]:
|
182 |
-
render_tab(trials[i])
|
|
|
38 |
|
39 |
st.image("img_klinic.jpeg", caption="(AI-generated image)", use_column_width=True)
|
40 |
st.title("Klìnic", help="AI-powered clinical trial search engine")
|
41 |
+
st.subheader("Find clinical trials in a scoped domain of biomedical research, guiding your research with AI-powered insights.")
|
42 |
|
43 |
with st.container(): # user input
|
44 |
col1, col2 = st.columns((6, 1))
|
45 |
|
46 |
with col1:
|
47 |
+
description_input = st.text_area(label="Enter a disease description 👇", placeholder='A disease that causes memory loss and other cognitive impairments.')
|
48 |
|
49 |
with col2:
|
50 |
st.text('') # dummy to center vertically
|
|
|
99 |
# graph
|
100 |
with st.container():
|
101 |
if show_graph:
|
102 |
+
st.info(
|
103 |
+
"""This is a graph of the relevant diseases that we found, based on the description that you entered. The diseases are connected by edges if they are similar to each other. The color of the edges represents the similarity of the diseases.
|
104 |
+
|
105 |
+
We use the embeddings of the diseases to determine the similarity between them. The embeddings are generated using a Representation Learning algorithm that learns the topological relations among the nodes in the graph, depending on how they are connected. We utilize the (PyKeen)[https://github.com/pykeen/pykeen] implementation of TransH to train an embedding model.
|
106 |
+
|
107 |
+
(TransH)[https://ojs.aaai.org/index.php/AAAI/article/view/8870] utilizes hyperplanes to model relations between entities. It is a multi-relational model that can handle many-to-many relations between entities. The model is trained on the triples of the graph, where the triples are the subject, relation, and object of the graph. The model learns the embeddings of the entities and the relations, such that the embeddings of the subject and object are close to each other when the relation is true.
|
108 |
+
|
109 |
+
Specifically, it optimizes the following cost function:
|
110 |
+
$$"""
|
111 |
+
)
|
112 |
# TODO actual graph
|
113 |
graph_of_diseases = agraph(
|
114 |
nodes=[
|
|
|
190 |
|
191 |
for i in range(0, len(tabs)):
|
192 |
with tabs[i]:
|
193 |
+
render_tab(trials[i])
|
utils.py
CHANGED
@@ -181,7 +181,7 @@ def get_clinical_trials_related_to_diseases(
|
|
181 |
with engine.connect() as conn:
|
182 |
with conn.begin():
|
183 |
sql = f"""
|
184 |
-
SELECT TOP
|
185 |
FROM Test.ClinicalTrials d
|
186 |
ORDER BY distance DESC
|
187 |
"""
|
|
|
181 |
with engine.connect() as conn:
|
182 |
with conn.begin():
|
183 |
sql = f"""
|
184 |
+
SELECT TOP 10 d.nct_id, VECTOR_COSINE(d.embedding, TO_VECTOR('{string_representation}', DOUBLE)) AS distance
|
185 |
FROM Test.ClinicalTrials d
|
186 |
ORDER BY distance DESC
|
187 |
"""
|