Spaces:
Sleeping
Sleeping
Delete templates
Browse files- templates/index.html +0 -14
- templates/result.html +0 -71
templates/index.html
DELETED
|
@@ -1,14 +0,0 @@
|
|
| 1 |
-
<!DOCTYPE html>
|
| 2 |
-
<html>
|
| 3 |
-
<head>
|
| 4 |
-
<title>PDF OCR</title>
|
| 5 |
-
<link href="/static/style.css" rel="stylesheet">
|
| 6 |
-
</head>
|
| 7 |
-
<body>
|
| 8 |
-
<h1>Upload PDF for OCR</h1>
|
| 9 |
-
<form action="/uploadfile/" enctype="multipart/form-data" method="post">
|
| 10 |
-
<input name="file" type="file" accept=".pdf">
|
| 11 |
-
<button type="submit">Upload</button>
|
| 12 |
-
</form>
|
| 13 |
-
</body>
|
| 14 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
templates/result.html
DELETED
|
@@ -1,71 +0,0 @@
|
|
| 1 |
-
<!DOCTYPE html>
|
| 2 |
-
<html>
|
| 3 |
-
<head>
|
| 4 |
-
<title>OCR Results</title>
|
| 5 |
-
<link href="/static/style.css" rel="stylesheet">
|
| 6 |
-
<script>
|
| 7 |
-
document.addEventListener("DOMContentLoaded", function() {
|
| 8 |
-
const results = {{ results | tojson | safe }};
|
| 9 |
-
const resultsContainer = document.getElementById('results-container');
|
| 10 |
-
|
| 11 |
-
results.forEach(result => {
|
| 12 |
-
const pageDiv = document.createElement('div');
|
| 13 |
-
pageDiv.className = 'page-result';
|
| 14 |
-
pageDiv.innerHTML = `
|
| 15 |
-
<h2>Page ${result.page_number}</h2>
|
| 16 |
-
<div class="loading-indicator" id="loading-indicator-${result.page_number}">Loading...</div>
|
| 17 |
-
<div class="result-content" id="result-content-${result.page_number}" style="display: none;">
|
| 18 |
-
${result.html}
|
| 19 |
-
</div>
|
| 20 |
-
`;
|
| 21 |
-
resultsContainer.appendChild(pageDiv);
|
| 22 |
-
});
|
| 23 |
-
|
| 24 |
-
// Load MathJax and MathPix Markdown-It scripts
|
| 25 |
-
const script1 = document.createElement('script');
|
| 26 |
-
script1.src = "https://cdn.jsdelivr.net/npm/mathpix-markdown-it@1.3.6/es5/bundle.js";
|
| 27 |
-
document.head.appendChild(script1);
|
| 28 |
-
|
| 29 |
-
script1.onload = function() {
|
| 30 |
-
const script2 = document.createElement('script');
|
| 31 |
-
script2.src = "https://polyfill.io/v3/polyfill.min.js?features=es6";
|
| 32 |
-
document.head.appendChild(script2);
|
| 33 |
-
|
| 34 |
-
script2.onload = function() {
|
| 35 |
-
const script3 = document.createElement('script');
|
| 36 |
-
script3.type = 'text/javascript';
|
| 37 |
-
script3.textContent = `
|
| 38 |
-
window.onload = function() {
|
| 39 |
-
const isLoaded = window.loadMathJax();
|
| 40 |
-
if (isLoaded) {
|
| 41 |
-
console.log('Styles loaded!');
|
| 42 |
-
}
|
| 43 |
-
|
| 44 |
-
const results = ${JSON.stringify(results)};
|
| 45 |
-
results.forEach(result => {
|
| 46 |
-
const contentDiv = document.getElementById(\`result-content-\${result.page_number}\`);
|
| 47 |
-
const loadingDiv = document.getElementById(\`loading-indicator-\${result.page_number}\`);
|
| 48 |
-
|
| 49 |
-
if (contentDiv) {
|
| 50 |
-
const options = {
|
| 51 |
-
htmlTags: true
|
| 52 |
-
};
|
| 53 |
-
const html = window.render(result.text, options);
|
| 54 |
-
contentDiv.innerHTML = html;
|
| 55 |
-
loadingDiv.style.display = 'none';
|
| 56 |
-
contentDiv.style.display = 'block';
|
| 57 |
-
}
|
| 58 |
-
});
|
| 59 |
-
};
|
| 60 |
-
`;
|
| 61 |
-
document.head.appendChild(script3);
|
| 62 |
-
};
|
| 63 |
-
};
|
| 64 |
-
});
|
| 65 |
-
</script>
|
| 66 |
-
</head>
|
| 67 |
-
<body>
|
| 68 |
-
<h1>OCR Results</h1>
|
| 69 |
-
<div id="results-container" class="scrollable-results"></div>
|
| 70 |
-
</body>
|
| 71 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|