Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -14,7 +14,7 @@ import plotly.express as px
|
|
14 |
st.set_page_config(
|
15 |
page_title="FATA4 Science",
|
16 |
page_icon=":microscope:",
|
17 |
-
layout="wide",
|
18 |
initial_sidebar_state="auto",
|
19 |
menu_items={
|
20 |
'About': "FATA4 Science is a Natural Language Processing (NLP) that ...."
|
@@ -119,11 +119,23 @@ if query:
|
|
119 |
fig = plt.gcf()
|
120 |
fig.patch.set_facecolor('#CCFFFF')
|
121 |
# # display the treemap in Streamlit
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
treemap1, treemap2 = st.columns(2)
|
123 |
with treemap1:
|
124 |
st.subheader(f"Top 10 Words closely related to {query}")
|
125 |
-
st.pyplot(fig)
|
126 |
-
plt.clf()
|
|
|
127 |
|
128 |
csv = table.head(100).to_csv().encode('utf-8')
|
129 |
st.download_button(label="download top 100 words (csv)", data=csv, file_name=f'{database_name}_words.csv', mime='text/csv')
|
@@ -162,10 +174,27 @@ if query:
|
|
162 |
fig2 = plt.gcf()
|
163 |
fig2.patch.set_facecolor('#CCFFFF')
|
164 |
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
165 |
# # display the treemap in Streamlit
|
166 |
with treemap2:
|
167 |
st.subheader(f"Top 10 Genes closely related to {query}")
|
168 |
-
st.pyplot(fig2)
|
|
|
169 |
|
170 |
csv = df1.head(100).to_csv().encode('utf-8')
|
171 |
st.download_button(label="download top 100 genes (csv)", data=csv, file_name=f'{database_name}_genes.csv',
|
@@ -208,6 +237,9 @@ if query:
|
|
208 |
st.video("https://www.youtube.com/watch?v=" + video_ids[2])
|
209 |
st.markdown("---")
|
210 |
|
|
|
|
|
|
|
211 |
|
212 |
|
213 |
|
|
|
14 |
st.set_page_config(
|
15 |
page_title="FATA4 Science",
|
16 |
page_icon=":microscope:",
|
17 |
+
layout="wide", #centered
|
18 |
initial_sidebar_state="auto",
|
19 |
menu_items={
|
20 |
'About': "FATA4 Science is a Natural Language Processing (NLP) that ...."
|
|
|
119 |
fig = plt.gcf()
|
120 |
fig.patch.set_facecolor('#CCFFFF')
|
121 |
# # display the treemap in Streamlit
|
122 |
+
|
123 |
+
rank_num = list(short_table.index.tolist())
|
124 |
+
avg_size = sum(sizes) / len(short_table.index)
|
125 |
+
print(rank_num)
|
126 |
+
# print(sizes)
|
127 |
+
fig = px.treemap(short_table, path=[short_table.index], values=sizes, color=sizes, color_continuous_scale='greens',
|
128 |
+
color_continuous_midpoint=avg_size)
|
129 |
+
fig.update(layout_coloraxis_showscale=False)
|
130 |
+
fig.update_layout(autosize=True, paper_bgcolor="#CCFFFF")
|
131 |
+
|
132 |
+
|
133 |
treemap1, treemap2 = st.columns(2)
|
134 |
with treemap1:
|
135 |
st.subheader(f"Top 10 Words closely related to {query}")
|
136 |
+
# st.pyplot(fig)
|
137 |
+
# plt.clf()
|
138 |
+
st.plotly_chart(fig, use_container_width=True)
|
139 |
|
140 |
csv = table.head(100).to_csv().encode('utf-8')
|
141 |
st.download_button(label="download top 100 words (csv)", data=csv, file_name=f'{database_name}_words.csv', mime='text/csv')
|
|
|
174 |
fig2 = plt.gcf()
|
175 |
fig2.patch.set_facecolor('#CCFFFF')
|
176 |
#
|
177 |
+
|
178 |
+
|
179 |
+
|
180 |
+
# link_ref = '<a href="http://google.com" style="cursor: pointer" target="_blank" rel="noopener noreferrer">{}</a>'
|
181 |
+
# df10['SIMILARITY'] = df10['SIMILARITY'].apply(lambda item: link_ref.format(item, "{}"))
|
182 |
+
rank_num = list(df10.index.tolist())
|
183 |
+
avg_size = sum(sizes) / len(df10.index)
|
184 |
+
print(rank_num)
|
185 |
+
# print(sizes)
|
186 |
+
fig = px.treemap(path=[df10.index], values=sizes, color=sizes, color_continuous_scale='greens',
|
187 |
+
color_continuous_midpoint=avg_size)
|
188 |
+
fig.update(layout_coloraxis_showscale=False)
|
189 |
+
fig.update_layout(autosize=True, paper_bgcolor="#CCFFFF", uniformtext_mode="hide", plot_bgcolor="#fff")
|
190 |
+
fig.update_traces(root_color='rgba(0,0,0,0)')
|
191 |
+
|
192 |
+
|
193 |
# # display the treemap in Streamlit
|
194 |
with treemap2:
|
195 |
st.subheader(f"Top 10 Genes closely related to {query}")
|
196 |
+
# st.pyplot(fig2)
|
197 |
+
st.plotly_chart(fig, use_container_width=True)
|
198 |
|
199 |
csv = df1.head(100).to_csv().encode('utf-8')
|
200 |
st.download_button(label="download top 100 genes (csv)", data=csv, file_name=f'{database_name}_genes.csv',
|
|
|
237 |
st.video("https://www.youtube.com/watch?v=" + video_ids[2])
|
238 |
st.markdown("---")
|
239 |
|
240 |
+
# fig = plt.figure()
|
241 |
+
|
242 |
+
|
243 |
|
244 |
|
245 |
|