awacke1 commited on
Commit
05c1b6a
·
verified ·
1 Parent(s): 5a01c50

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -420,10 +420,12 @@ if st.button('Analyze'):
420
  # Perform text preprocessing
421
  vectorizer = CountVectorizer(stop_words='english')
422
  X = vectorizer.fit_transform([text_input])
 
 
423
 
424
  # Perform dictionary learning
425
  dl = DictionaryLearning(n_components=n_components, transform_algorithm='lasso_lars', random_state=0)
426
- X_transformed = dl.fit_transform(X)
427
  dictionary = dl.components_
428
 
429
  # Get the feature names (terms)
@@ -461,8 +463,5 @@ if st.button('Analyze'):
461
  nx.draw_networkx_labels(G, pos, font_size=8)
462
  ax.axis('off')
463
  st.pyplot(fig)
464
-
465
-
466
-
467
 
468
 
 
420
  # Perform text preprocessing
421
  vectorizer = CountVectorizer(stop_words='english')
422
  X = vectorizer.fit_transform([text_input])
423
+ # Convert sparse matrix to dense numpy array
424
+ X_dense = X.toarray()
425
 
426
  # Perform dictionary learning
427
  dl = DictionaryLearning(n_components=n_components, transform_algorithm='lasso_lars', random_state=0)
428
+ X_transformed = dl.fit_transform(X_dense)
429
  dictionary = dl.components_
430
 
431
  # Get the feature names (terms)
 
463
  nx.draw_networkx_labels(G, pos, font_size=8)
464
  ax.axis('off')
465
  st.pyplot(fig)
 
 
 
466
 
467