Spaces:
Running
Running
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>PaddleOCR Web App</title> | |
<!-- Bootstrap CSS --> | |
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"> | |
<!-- Custom styles --> | |
<link href="{{ url_for('static', filename='style.css') }}" rel="stylesheet"> | |
</head> | |
<body> | |
<div class="container text-center"> | |
<h1 class="mt-4">OCR with PaddleOCR</h1> | |
<!-- Upload form --> | |
<form id="upload-form" method="post" action="/" enctype="multipart/form-data" class="mt-4"> | |
<div class="mb-3"> | |
<input type="file" class="form-control" name="image" accept="image/*" required> | |
</div> | |
<button type="submit" class="btn btn-primary">Upload Image</button> | |
</form> | |
<!-- Loading spinner (hidden by default) --> | |
<div id="spinner" class="mt-3 d-none"> | |
<div class="spinner-border text-primary" role="status"> | |
<span class="visually-hidden">Processing...</span> | |
</div> | |
</div> | |
{% if filename %} | |
<!-- Display the uploaded image and extracted text --> | |
<div class="mt-4"> | |
<h4>Uploaded Image:</h4> | |
<img src="{{ url_for('static', filename='uploads/' + filename) }}" | |
alt="Uploaded Image" class="img-fluid" id="result-img"> | |
<h4 class="mt-3">Extracted Text:</h4> | |
<pre id="extracted-text">{{ extracted_text }}</pre> | |
</div> | |
{% endif %} | |
</div> | |
<!-- Show spinner on form submit --> | |
<script> | |
document.getElementById('upload-form').onsubmit = function() { | |
document.getElementById('spinner').classList.remove('d-none'); | |
}; | |
</script> | |
</body> | |
</html> | |