Spaces:
Runtime error
Runtime error
Tyler Burns
commited on
Commit
•
ed172d3
1
Parent(s):
1a64589
removed br from text for table
Browse files
app.py
CHANGED
@@ -6,6 +6,7 @@ import umap.umap_ as umap
|
|
6 |
import numpy as np
|
7 |
import sys
|
8 |
import plotly.express as px
|
|
|
9 |
|
10 |
# The search bar
|
11 |
keywords = st.text_input('Enter your search', 'The future of AI')
|
@@ -37,7 +38,7 @@ columns = ['title', 'href', 'body']
|
|
37 |
# Merge the data together
|
38 |
dat = pd.concat([md.reset_index(), dimr.reset_index()], axis = 1)
|
39 |
|
40 |
-
#
|
41 |
dat = dat.loc[:,~dat.columns.duplicated()]
|
42 |
|
43 |
# Get it ready for plotting
|
@@ -58,5 +59,9 @@ fig.update_layout(
|
|
58 |
# Show the figure
|
59 |
st.plotly_chart(fig, use_container_width=True)
|
60 |
|
|
|
|
|
|
|
|
|
61 |
# Place a table under the plot
|
62 |
st.dataframe(dat)
|
|
|
6 |
import numpy as np
|
7 |
import sys
|
8 |
import plotly.express as px
|
9 |
+
import re
|
10 |
|
11 |
# The search bar
|
12 |
keywords = st.text_input('Enter your search', 'The future of AI')
|
|
|
38 |
# Merge the data together
|
39 |
dat = pd.concat([md.reset_index(), dimr.reset_index()], axis = 1)
|
40 |
|
41 |
+
# handle duplicate index columns
|
42 |
dat = dat.loc[:,~dat.columns.duplicated()]
|
43 |
|
44 |
# Get it ready for plotting
|
|
|
59 |
# Show the figure
|
60 |
st.plotly_chart(fig, use_container_width=True)
|
61 |
|
62 |
+
# Remove <br> in the text for the table
|
63 |
+
dat['title'] = [re.sub('<br>', ' ', i) for i in dat['title']]
|
64 |
+
dat['body'] = [re.sub('<br>', ' ', i) for i in dat['body']]
|
65 |
+
|
66 |
# Place a table under the plot
|
67 |
st.dataframe(dat)
|