Spaces:
Sleeping
Sleeping
skanderovitch
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -131,7 +131,7 @@ embeddings = pd.read_parquet('./embeddings.parquet')
|
|
131 |
|
132 |
# similarities = pd.DataFrame(similarities,columns = 'theme party1 party2 similarity'.split()).set_index('theme party1 party2'.split())['similarity'].reset_index()
|
133 |
# similarities.to_parquet('./similarities.parquet')
|
134 |
-
similarities = pd.read_parquet('./similarities.parquet')
|
135 |
|
136 |
# similarities.loc[('Debt',slice(None),slice(None))].reset_index()
|
137 |
|
@@ -152,7 +152,6 @@ themes = st.multiselect(
|
|
152 |
list(data.index),
|
153 |
list(data.index))
|
154 |
|
155 |
-
st.write("You selected:", themes)
|
156 |
|
157 |
|
158 |
subset = embeddings.loc[themes,parties]
|
@@ -172,7 +171,7 @@ projection = pd.DataFrame(projection,columns=['x','y'])
|
|
172 |
projection['text'] = parties
|
173 |
projection['color'] = parties
|
174 |
projection['hover'] = data.loc[themes,parties].T.apply(lambda l: '<br>'.join(l.tolist()),axis=1).values
|
175 |
-
|
176 |
fig = px.scatter(projection,x='x', y='y', text='text', color='text', hover_data=["hover"])
|
177 |
fig.update_traces(marker=dict(size=12,
|
178 |
line=dict(width=2,
|
|
|
131 |
|
132 |
# similarities = pd.DataFrame(similarities,columns = 'theme party1 party2 similarity'.split()).set_index('theme party1 party2'.split())['similarity'].reset_index()
|
133 |
# similarities.to_parquet('./similarities.parquet')
|
134 |
+
# similarities = pd.read_parquet('./similarities.parquet')
|
135 |
|
136 |
# similarities.loc[('Debt',slice(None),slice(None))].reset_index()
|
137 |
|
|
|
152 |
list(data.index),
|
153 |
list(data.index))
|
154 |
|
|
|
155 |
|
156 |
|
157 |
subset = embeddings.loc[themes,parties]
|
|
|
171 |
projection['text'] = parties
|
172 |
projection['color'] = parties
|
173 |
projection['hover'] = data.loc[themes,parties].T.apply(lambda l: '<br>'.join(l.tolist()),axis=1).values
|
174 |
+
|
175 |
fig = px.scatter(projection,x='x', y='y', text='text', color='text', hover_data=["hover"])
|
176 |
fig.update_traces(marker=dict(size=12,
|
177 |
line=dict(width=2,
|