Spaces:
Running
on
Zero
Running
on
Zero
Underscore only sole space patches
Browse files
app.py
CHANGED
@@ -321,11 +321,12 @@ class BytelatentProcessor:
|
|
321 |
|
322 |
# Create highlighted text data
|
323 |
_highlighted_data, patch_count = self._create_highlight_data(patch_lengths, tokens)
|
324 |
-
ind_highlighted_data = [(text.replace("
|
325 |
grouped_data = defaultdict(str)
|
326 |
for text, label in ind_highlighted_data:
|
327 |
grouped_data[label] += text
|
328 |
-
|
|
|
329 |
|
330 |
# Create plot
|
331 |
fig = None
|
|
|
321 |
|
322 |
# Create highlighted text data
|
323 |
_highlighted_data, patch_count = self._create_highlight_data(patch_lengths, tokens)
|
324 |
+
ind_highlighted_data = [(text.replace("-1", ""), label) for text, label in _highlighted_data]
|
325 |
grouped_data = defaultdict(str)
|
326 |
for text, label in ind_highlighted_data:
|
327 |
grouped_data[label] += text
|
328 |
+
underscore_sole_space_patch = lambda text: text.replace(" ", "_") if text == " " else text
|
329 |
+
highlighted_data = [(underscore_sole_space_patch(text), label) for label, text in grouped_data.items()]
|
330 |
|
331 |
# Create plot
|
332 |
fig = None
|