Spaces:
Running
Running
Commit
·
f957de1
1
Parent(s):
71afe01
Added random seed to topic_core_funcs
Browse files
funcs/topic_core_funcs.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
# Dendrograms will not work with the latest version of scipy (1.12.0), so installing the version prior to be safe
|
| 2 |
#os.system("pip install scipy==1.11.4")
|
| 3 |
-
|
| 4 |
import gradio as gr
|
| 5 |
from datetime import datetime
|
| 6 |
import pandas as pd
|
|
@@ -26,6 +26,7 @@ from umap import UMAP
|
|
| 26 |
umap_n_neighbours = 15
|
| 27 |
umap_min_dist = 0.0
|
| 28 |
umap_metric = 'cosine'
|
|
|
|
| 29 |
|
| 30 |
today = datetime.now().strftime("%d%m%Y")
|
| 31 |
today_rev = datetime.now().strftime("%Y%m%d")
|
|
@@ -545,6 +546,7 @@ def reduce_outliers(topic_model: BERTopic, docs: List[str], embeddings_out: np.n
|
|
| 545 |
|
| 546 |
return output_text, output_list, topic_model
|
| 547 |
|
|
|
|
| 548 |
def represent_topics(topic_model: BERTopic, docs: List[str], data_file_name_no_ext: str, high_quality_mode: str, save_topic_model: str, representation_type: str, vectoriser_model: CountVectorizer, split_sentence_drop: str, data: PandasDataFrame, progress: gr.Progress = gr.Progress(track_tqdm=True)) -> tuple:
|
| 549 |
"""
|
| 550 |
Represents topics using the specified representation model and updates the topic labels accordingly.
|
|
|
|
| 1 |
# Dendrograms will not work with the latest version of scipy (1.12.0), so installing the version prior to be safe
|
| 2 |
#os.system("pip install scipy==1.11.4")
|
| 3 |
+
import spaces
|
| 4 |
import gradio as gr
|
| 5 |
from datetime import datetime
|
| 6 |
import pandas as pd
|
|
|
|
| 26 |
umap_n_neighbours = 15
|
| 27 |
umap_min_dist = 0.0
|
| 28 |
umap_metric = 'cosine'
|
| 29 |
+
random_seed = 42
|
| 30 |
|
| 31 |
today = datetime.now().strftime("%d%m%Y")
|
| 32 |
today_rev = datetime.now().strftime("%Y%m%d")
|
|
|
|
| 546 |
|
| 547 |
return output_text, output_list, topic_model
|
| 548 |
|
| 549 |
+
@spaces.GPU(duration=120)
|
| 550 |
def represent_topics(topic_model: BERTopic, docs: List[str], data_file_name_no_ext: str, high_quality_mode: str, save_topic_model: str, representation_type: str, vectoriser_model: CountVectorizer, split_sentence_drop: str, data: PandasDataFrame, progress: gr.Progress = gr.Progress(track_tqdm=True)) -> tuple:
|
| 551 |
"""
|
| 552 |
Represents topics using the specified representation model and updates the topic labels accordingly.
|