From 6afba065a1baabe9e74c20b1f2c192de5a8c850a Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Sun, 7 May 2023 04:03:17 -0300 Subject: [PATCH] Only update the chroma database when necessary --- extensions/superbig/script.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/extensions/superbig/script.py b/extensions/superbig/script.py index dafc63e5..b20f243d 100644 --- a/extensions/superbig/script.py +++ b/extensions/superbig/script.py @@ -64,7 +64,6 @@ class SentenceTransformerEmbedder(Embedder): embedder = SentenceTransformerEmbedder() collector = ChromaCollector(embedder) -global_data = '' def feed_data_into_collector(corpus): @@ -86,7 +85,6 @@ def input_modifier(string): user_input = '' # Get the 5 most similar chunks - feed_data_into_collector(global_data) results = collector.get(user_input, n_results=5) # Make the replacements @@ -141,5 +139,5 @@ def ui(): last_updated = gr.Markdown() update.click( - lambda x: globals().update(global_data=x), data_input, None).then( + feed_data_into_collector, data_input, None).then( lambda: "Last updated on " + str(datetime.datetime.now()), None, last_updated, show_progress=False)