Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
import pandas as pd
|
| 3 |
from transformers import AutoTokenizer, AutoModel, AutoModelForSequenceClassification, pipeline
|
|
|
|
| 4 |
from bertopic import BERTopic
|
| 5 |
import torch
|
| 6 |
import numpy as np
|
|
@@ -318,7 +319,7 @@ if uploaded_file is not None:
|
|
| 318 |
|
| 319 |
if topic_strategy == "Manual":
|
| 320 |
n_documents = len(df)
|
| 321 |
-
max_topics = max(
|
| 322 |
|
| 323 |
n_topics = st.slider(
|
| 324 |
"Number of Topics",
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import pandas as pd
|
| 3 |
from transformers import AutoTokenizer, AutoModel, AutoModelForSequenceClassification, pipeline
|
| 4 |
+
from sklearn.feature_extraction.text import CountVectorizer
|
| 5 |
from bertopic import BERTopic
|
| 6 |
import torch
|
| 7 |
import numpy as np
|
|
|
|
| 319 |
|
| 320 |
if topic_strategy == "Manual":
|
| 321 |
n_documents = len(df)
|
| 322 |
+
max_topics = max(3, min(50, n_documents // 20))
|
| 323 |
|
| 324 |
n_topics = st.slider(
|
| 325 |
"Number of Topics",
|