Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -96,7 +96,7 @@ if query:
|
|
96 |
# table.head(10).to_csv("clotting_sim1.csv", index=True)
|
97 |
# short_table = table.head(50)
|
98 |
# print(table)
|
99 |
-
|
100 |
|
101 |
# calculate the sizes of the squares in the treemap
|
102 |
short_table = table.head(10)
|
@@ -115,11 +115,14 @@ if query:
|
|
115 |
fig = plt.gcf()
|
116 |
fig.patch.set_facecolor('#CCFFFF')
|
117 |
# # display the treemap in Streamlit
|
118 |
-
st.
|
119 |
-
|
|
|
|
|
|
|
120 |
|
121 |
-
|
122 |
-
|
123 |
|
124 |
# st.write(short_table)
|
125 |
#
|
@@ -136,7 +139,7 @@ if query:
|
|
136 |
print()
|
137 |
# df1.head(50).to_csv("clotting_sim2.csv", index=True, header=False)
|
138 |
# time.sleep(2)
|
139 |
-
|
140 |
|
141 |
df10 = df1.head(10)
|
142 |
df10.index = 1 / df10.index
|
@@ -157,12 +160,15 @@ if query:
|
|
157 |
# plt.show()
|
158 |
#
|
159 |
# # display the treemap in Streamlit
|
160 |
-
|
|
|
|
|
161 |
|
162 |
-
|
163 |
-
|
164 |
mime='text/csv')
|
165 |
-
|
|
|
166 |
if query:
|
167 |
idlist=[]
|
168 |
search_keyword = {query}
|
@@ -189,27 +195,12 @@ if query:
|
|
189 |
random.shuffle(video_ids)
|
190 |
|
191 |
c1, c2, c3 = st.columns(3)
|
|
|
|
|
192 |
with c1:
|
193 |
st.video("https://www.youtube.com/watch?v=" + video_ids[0])
|
194 |
with c2:
|
195 |
st.video("https://www.youtube.com/watch?v=" + video_ids[1])
|
196 |
with c3:
|
197 |
st.video("https://www.youtube.com/watch?v=" + video_ids[2])
|
198 |
-
|
199 |
-
# side = 30 # (100-width)/2
|
200 |
-
# _, container, _ = st.columns([side, width, side])
|
201 |
-
# container.video(data=VIDEO_DATA)
|
202 |
-
|
203 |
-
# VIDEO_DATA = "https://www.youtube.com/watch?v=" + video_ids[1]
|
204 |
-
# width = 40
|
205 |
-
# side = 30 # (100-width)/2
|
206 |
-
# _, container, _ = st.columns([side, width, side])
|
207 |
-
# container.video(data=VIDEO_DATA)
|
208 |
-
|
209 |
-
# VIDEO_DATA = "https://www.youtube.com/watch?v=" + video_ids[2]
|
210 |
-
# width = 40
|
211 |
-
# side = 30 # (100-width)/2
|
212 |
-
# _, container, _ = st.columns([side, width, side])
|
213 |
-
# container.video(data=VIDEO_DATA)
|
214 |
-
|
215 |
-
|
|
|
96 |
# table.head(10).to_csv("clotting_sim1.csv", index=True)
|
97 |
# short_table = table.head(50)
|
98 |
# print(table)
|
99 |
+
|
100 |
|
101 |
# calculate the sizes of the squares in the treemap
|
102 |
short_table = table.head(10)
|
|
|
115 |
fig = plt.gcf()
|
116 |
fig.patch.set_facecolor('#CCFFFF')
|
117 |
# # display the treemap in Streamlit
|
118 |
+
treemap1, treemap2 = st.columns(2)
|
119 |
+
with treemap1:
|
120 |
+
st.subheader(f"Top 10 Words closely related to {query}")
|
121 |
+
st.pyplot(fig)
|
122 |
+
plt.clf()
|
123 |
|
124 |
+
csv = table.head(100).to_csv().encode('utf-8')
|
125 |
+
st.download_button(label="download top 100 words (csv)", data=csv, file_name=f'{database_name}_words.csv', mime='text/csv')
|
126 |
|
127 |
# st.write(short_table)
|
128 |
#
|
|
|
139 |
print()
|
140 |
# df1.head(50).to_csv("clotting_sim2.csv", index=True, header=False)
|
141 |
# time.sleep(2)
|
142 |
+
|
143 |
|
144 |
df10 = df1.head(10)
|
145 |
df10.index = 1 / df10.index
|
|
|
160 |
# plt.show()
|
161 |
#
|
162 |
# # display the treemap in Streamlit
|
163 |
+
with treemap2:
|
164 |
+
st.subheader(f"Top 10 Genes closely related to {query}")
|
165 |
+
st.pyplot(fig2)
|
166 |
|
167 |
+
csv = df1.head(100).to_csv().encode('utf-8')
|
168 |
+
st.download_button(label="download top 100 genes (csv)", data=csv, file_name=f'{database_name}_genes.csv',
|
169 |
mime='text/csv')
|
170 |
+
st.markdown("---")
|
171 |
+
st.subheader("Cancer-related videos")
|
172 |
if query:
|
173 |
idlist=[]
|
174 |
search_keyword = {query}
|
|
|
195 |
random.shuffle(video_ids)
|
196 |
|
197 |
c1, c2, c3 = st.columns(3)
|
198 |
+
|
199 |
+
|
200 |
with c1:
|
201 |
st.video("https://www.youtube.com/watch?v=" + video_ids[0])
|
202 |
with c2:
|
203 |
st.video("https://www.youtube.com/watch?v=" + video_ids[1])
|
204 |
with c3:
|
205 |
st.video("https://www.youtube.com/watch?v=" + video_ids[2])
|
206 |
+
st.markdown("---")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|