akhil commited on
Commit ·
c191687
1
Parent(s): adde2e3
recent changes
Browse files
app.py
CHANGED
|
@@ -24,7 +24,12 @@ def load_tokenized_dataset_v2(directory_path):
|
|
| 24 |
def get_input_ids(text, tokenized_dataset):
|
| 25 |
# Try to find a close match in the pre-tokenized dataset
|
| 26 |
for entry in tokenized_dataset:
|
| 27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
return entry['input_ids']
|
| 29 |
|
| 30 |
# If no match is found, tokenize the input text on the fly
|
|
|
|
| 24 |
def get_input_ids(text, tokenized_dataset):
|
| 25 |
# Try to find a close match in the pre-tokenized dataset
|
| 26 |
for entry in tokenized_dataset:
|
| 27 |
+
ai_text = entry['ai_text']
|
| 28 |
+
# Handle case where ai_text is a list
|
| 29 |
+
if isinstance(ai_text, list):
|
| 30 |
+
ai_text = " ".join(ai_text) # Join list elements into a single string
|
| 31 |
+
|
| 32 |
+
if ai_text.strip() == text.strip():
|
| 33 |
return entry['input_ids']
|
| 34 |
|
| 35 |
# If no match is found, tokenize the input text on the fly
|