Spaces:
Runtime error
Runtime error
delete vars
Browse files
app.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
import spaces
|
| 2 |
import gradio as gr
|
| 3 |
|
| 4 |
import logging
|
|
@@ -43,7 +43,6 @@ CHUNK_SIZE = int(os.getenv("CHUNK_SIZE", "2_000"))
|
|
| 43 |
DATASETS_TOPICS_ORGANIZATION = os.getenv(
|
| 44 |
"DATASETS_TOPICS_ORGANIZATION", "datasets-topics"
|
| 45 |
)
|
| 46 |
-
USE_ARROW_STYLE = int(os.getenv("USE_ARROW_STYLE", "0"))
|
| 47 |
USE_CUML = int(os.getenv("USE_CUML", "1"))
|
| 48 |
USE_LLM_TEXT_GENERATION = int(os.getenv("USE_LLM_TEXT_GENERATION", "1"))
|
| 49 |
|
|
@@ -144,7 +143,7 @@ def fit_model(docs, embeddings, n_neighbors, n_components):
|
|
| 144 |
return new_model
|
| 145 |
|
| 146 |
|
| 147 |
-
@spaces.GPU(duration=60 * 5)
|
| 148 |
def generate_topics(dataset, config, split, column, plot_type):
|
| 149 |
logging.info(
|
| 150 |
f"Generating topics for {dataset=} {config=} {split=} {column=} {plot_type=}"
|
|
@@ -282,7 +281,7 @@ def generate_topics(dataset, config, split, column, plot_type):
|
|
| 282 |
)
|
| 283 |
|
| 284 |
offset += CHUNK_SIZE
|
| 285 |
-
|
| 286 |
logging.info("Finished processing all data")
|
| 287 |
|
| 288 |
dataset_clear_name = dataset.replace("/", "-")
|
|
@@ -344,6 +343,15 @@ def generate_topics(dataset, config, split, column, plot_type):
|
|
| 344 |
),
|
| 345 |
f"[]({space_link})",
|
| 346 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 347 |
cuda.empty_cache()
|
| 348 |
|
| 349 |
|
|
|
|
| 1 |
+
# import spaces
|
| 2 |
import gradio as gr
|
| 3 |
|
| 4 |
import logging
|
|
|
|
| 43 |
DATASETS_TOPICS_ORGANIZATION = os.getenv(
|
| 44 |
"DATASETS_TOPICS_ORGANIZATION", "datasets-topics"
|
| 45 |
)
|
|
|
|
| 46 |
USE_CUML = int(os.getenv("USE_CUML", "1"))
|
| 47 |
USE_LLM_TEXT_GENERATION = int(os.getenv("USE_LLM_TEXT_GENERATION", "1"))
|
| 48 |
|
|
|
|
| 143 |
return new_model
|
| 144 |
|
| 145 |
|
| 146 |
+
# @spaces.GPU(duration=60 * 5)
|
| 147 |
def generate_topics(dataset, config, split, column, plot_type):
|
| 148 |
logging.info(
|
| 149 |
f"Generating topics for {dataset=} {config=} {split=} {column=} {plot_type=}"
|
|
|
|
| 281 |
)
|
| 282 |
|
| 283 |
offset += CHUNK_SIZE
|
| 284 |
+
del docs, embeddings, new_model, reduced_embeddings
|
| 285 |
logging.info("Finished processing all data")
|
| 286 |
|
| 287 |
dataset_clear_name = dataset.replace("/", "-")
|
|
|
|
| 343 |
),
|
| 344 |
f"[]({space_link})",
|
| 345 |
)
|
| 346 |
+
del reduce_umap_model, all_docs, reduced_embeddings_list
|
| 347 |
+
del (
|
| 348 |
+
base_model,
|
| 349 |
+
all_topics,
|
| 350 |
+
topic_info,
|
| 351 |
+
topic_names,
|
| 352 |
+
topic_names_array,
|
| 353 |
+
interactive_plot,
|
| 354 |
+
)
|
| 355 |
cuda.empty_cache()
|
| 356 |
|
| 357 |
|