Updates
Browse files
app.py
CHANGED
|
@@ -37,6 +37,7 @@ def patch_tqdm_for_gradio(progress):
|
|
| 37 |
|
| 38 |
def update(self, n=1):
|
| 39 |
super().update(n)
|
|
|
|
| 40 |
if self.n % self.update_interval == 0 or self.n == self.total_batches:
|
| 41 |
self.progress(self.n / self.total_batches)
|
| 42 |
|
|
@@ -44,7 +45,7 @@ def patch_tqdm_for_gradio(progress):
|
|
| 44 |
|
| 45 |
def patch_model2vec_tqdm(progress):
|
| 46 |
patched_tqdm = patch_tqdm_for_gradio(progress)
|
| 47 |
-
model2vec.tqdm = patched_tqdm # Replace tqdm in
|
| 48 |
|
| 49 |
# Function to patch the original encode function with our Gradio tqdm
|
| 50 |
def original_encode_with_tqdm(original_encode_func, patched_tqdm):
|
|
@@ -160,7 +161,11 @@ def perform_deduplication(
|
|
| 160 |
#model.encode = original_encode_with_tqdm(model.encode, patched_tqdm)
|
| 161 |
# Compute embeddings
|
| 162 |
status = "Computing embeddings for Dataset 1..."
|
|
|
|
|
|
|
| 163 |
yield status, ""
|
|
|
|
|
|
|
| 164 |
embedding_matrix = model.encode(texts, show_progressbar=True)
|
| 165 |
# embedding_matrix = compute_embeddings(
|
| 166 |
# texts,
|
|
|
|
| 37 |
|
| 38 |
def update(self, n=1):
|
| 39 |
super().update(n)
|
| 40 |
+
# Update Gradio progress bar every update_interval steps
|
| 41 |
if self.n % self.update_interval == 0 or self.n == self.total_batches:
|
| 42 |
self.progress(self.n / self.total_batches)
|
| 43 |
|
|
|
|
| 45 |
|
| 46 |
def patch_model2vec_tqdm(progress):
|
| 47 |
patched_tqdm = patch_tqdm_for_gradio(progress)
|
| 48 |
+
model2vec.tqdm = patched_tqdm # Replace tqdm in model2vec
|
| 49 |
|
| 50 |
# Function to patch the original encode function with our Gradio tqdm
|
| 51 |
def original_encode_with_tqdm(original_encode_func, patched_tqdm):
|
|
|
|
| 161 |
#model.encode = original_encode_with_tqdm(model.encode, patched_tqdm)
|
| 162 |
# Compute embeddings
|
| 163 |
status = "Computing embeddings for Dataset 1..."
|
| 164 |
+
|
| 165 |
+
# Remove?
|
| 166 |
yield status, ""
|
| 167 |
+
|
| 168 |
+
|
| 169 |
embedding_matrix = model.encode(texts, show_progressbar=True)
|
| 170 |
# embedding_matrix = compute_embeddings(
|
| 171 |
# texts,
|