Spaces:
Sleeping
Sleeping
Jesse Liu commited on
Commit ·
345cecc
1
Parent(s): 762a6de
Debug: Check sentence existence before HTML escaping
Browse files- chatgpt.py +13 -0
chatgpt.py
CHANGED
|
@@ -1213,6 +1213,9 @@ with gr.Blocks() as app:
|
|
| 1213 |
if not base:
|
| 1214 |
return gr.update(value="<pre>No input data</pre>")
|
| 1215 |
|
|
|
|
|
|
|
|
|
|
| 1216 |
# Escape HTML
|
| 1217 |
html_text = base.replace('&', '&').replace('<', '<').replace('>', '>')
|
| 1218 |
|
|
@@ -1234,6 +1237,16 @@ with gr.Blocks() as app:
|
|
| 1234 |
print(f"[Highlight] Match #{idx+1}: Empty sentence, skipping")
|
| 1235 |
continue
|
| 1236 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1237 |
# Escape HTML in sentence
|
| 1238 |
escaped_sentence = sentence.replace('&', '&').replace('<', '<').replace('>', '>')
|
| 1239 |
|
|
|
|
| 1213 |
if not base:
|
| 1214 |
return gr.update(value="<pre>No input data</pre>")
|
| 1215 |
|
| 1216 |
+
print(f"[Highlight] Input text length: {len(base)} chars")
|
| 1217 |
+
print(f"[Highlight] Input text first 100 chars: {base[:100]}")
|
| 1218 |
+
|
| 1219 |
# Escape HTML
|
| 1220 |
html_text = base.replace('&', '&').replace('<', '<').replace('>', '>')
|
| 1221 |
|
|
|
|
| 1237 |
print(f"[Highlight] Match #{idx+1}: Empty sentence, skipping")
|
| 1238 |
continue
|
| 1239 |
|
| 1240 |
+
# Check if sentence exists in original text BEFORE escaping
|
| 1241 |
+
if sentence not in base:
|
| 1242 |
+
print(f"[Highlight] Match #{idx+1}: Sentence not in original text")
|
| 1243 |
+
print(f"[Highlight] Looking for: {sentence[:80]}")
|
| 1244 |
+
# Try to find partial match
|
| 1245 |
+
sentence_parts = sentence.split('\n')[0] # Try first line
|
| 1246 |
+
if sentence_parts in base:
|
| 1247 |
+
print(f"[Highlight] Found partial match: {sentence_parts[:60]}")
|
| 1248 |
+
continue
|
| 1249 |
+
|
| 1250 |
# Escape HTML in sentence
|
| 1251 |
escaped_sentence = sentence.replace('&', '&').replace('<', '<').replace('>', '>')
|
| 1252 |
|