Spaces:
Sleeping
Sleeping
Commit ·
becf438
1
Parent(s): 4f8b3ce
Upd syntax
Browse filesFiles changed (2)
- app.py+2-2
- vi/processing.py+5-5
199 unmodified lines20020120220320420520633 unmodified lines240241242243244245246199 unmodified linesasync function startJob(dataset) {{const log = document.getElementById("log");const vietnameseToggle = document.getElementById("vietnameseTranslation");const isVietnameseMode = vietnameseToggle.checked;log.innerHTML = "⏳ Starting job for <b>" + dataset + "</b>" + (isVietnameseMode ? " with Vietnamese translation" : "") + "...";try {{33 unmodified linesasync function startRagJob(dataset) {{const log = document.getElementById("log");const vietnameseToggle = document.getElementById("vietnameseTranslation");const isVietnameseMode = vietnameseToggle.checked;log.innerHTML = "⏳ Starting RAG processing for <b>" + dataset + "</b>" + (isVietnameseMode ? " with Vietnamese translation" : "") + "...";try {{199 unmodified lines20020120220320420520633 unmodified lines240241242243244245246199 unmodified linesasync function startJob(dataset) {{const log = document.getElementById("log");const vietnameseToggle = document.getElementById("vietnameseTranslation");const isVietnameseMode = vietnameseToggle ? vietnameseToggle.checked : false;log.innerHTML = "⏳ Starting job for <b>" + dataset + "</b>" + (isVietnameseMode ? " with Vietnamese translation" : "") + "...";try {{33 unmodified linesasync function startRagJob(dataset) {{const log = document.getElementById("log");const vietnameseToggle = document.getElementById("vietnameseTranslation");const isVietnameseMode = vietnameseToggle ? vietnameseToggle.checked : false;log.innerHTML = "⏳ Starting RAG processing for <b>" + dataset + "</b>" + (isVietnameseMode ? " with Vietnamese translation" : "") + "...";try {{
98 unmodified lines9910010110210310410549 unmodified lines15515615715815916016110 unmodified lines17217317417517617717854 unmodified lines23323423523623723823910 unmodified lines25025125225325425525698 unmodified lines# If no Vietnamese characters but significantly different from original, accept it# (some translations might not have Vietnamese diacritics)if len(translated) > len(original) * 0.5 and len(translated) < len(original) * 2.0:return Truereturn False49 unmodified lineslogger.debug(f" Are they the same? {original == translated}")# Validate and sanitize translated fieldif _validate_vi_translation(original, translated):translated_sft[field] = _vi_sanitize_text(translated)logger.debug(f"✅ Successfully translated field '{field}'")# Add success statistics if stats available10 unmodified linesexcept Exception as e:logger.error(f"Failed to translate field '{field}': {e}")translated_sft[field] = sft_data[field]else:# Keep original if field doesn't exist or is emptytranslated_sft[field] = sft_data.get(field, "")54 unmodified lineslogger.debug(f" Are they the same? {original == translated}")# Validate and sanitize translated fieldif _validate_vi_translation(original, translated):translated_row[field] = _vi_sanitize_text(translated)logger.debug(f"✅ Successfully translated RAG field '{field}'")# Add success statistics if stats available10 unmodified linesexcept Exception as e:logger.error(f"Failed to translate RAG field '{field}': {e}")translated_row[field] = row[field]else:# Keep original if field doesn't exist or is emptytranslated_row[field] = row.get(field, "")98 unmodified lines9910010110210310410549 unmodified lines15515615715815916016110 unmodified lines17217317417517617717854 unmodified lines23323423523623723823910 unmodified lines25025125225325425525698 unmodified lines# If no Vietnamese characters but significantly different from original, accept it# (some translations might not have Vietnamese diacritics)if len(translated) > len(original) * 0.5 and len(translated) < len(original) * 2.0:return Truereturn False49 unmodified lineslogger.debug(f" Are they the same? {original == translated}")# Validate and sanitize translated fieldif _validate_vi_translation(original, translated):translated_sft[field] = _vi_sanitize_text(translated)logger.debug(f"✅ Successfully translated field '{field}'")# Add success statistics if stats available10 unmodified linesexcept Exception as e:logger.error(f"Failed to translate field '{field}': {e}")translated_sft[field] = sft_data[field]else:# Keep original if field doesn't exist or is emptytranslated_sft[field] = sft_data.get(field, "")54 unmodified lineslogger.debug(f" Are they the same? {original == translated}")# Validate and sanitize translated fieldif _validate_vi_translation(original, translated):translated_row[field] = _vi_sanitize_text(translated)logger.debug(f"✅ Successfully translated RAG field '{field}'")# Add success statistics if stats available10 unmodified linesexcept Exception as e:logger.error(f"Failed to translate RAG field '{field}': {e}")translated_row[field] = row[field]else:# Keep original if field doesn't exist or is emptytranslated_row[field] = row.get(field, "")
app.py+2-2
vi/processing.py+5-5