my-ocr-demo / templates /index.html
gahanmakwana's picture
Fixed file upload and OCR functionality
44154a0
raw
history blame
1.22 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>OCR Application</title>
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;600&display=swap" rel="stylesheet">
</head>
<body>
<div class="container">
<h1>Image Text Extractor</h1>
<!-- Upload Form -->
<form method="POST" enctype="multipart/form-data" class="upload-form">
<input type="file" name="file" id="file" required>
<button type="submit">Upload Image</button>
</form>
{% if error %}
<div class="error">{{ error }}</div>
{% endif %}
{% if filename %}
<div class="preview">
<h2>Uploaded Image</h2>
<img src="{{ url_for('uploaded_file', filename=filename) }}" alt="Uploaded Image">
</div>
{% endif %}
{% if text %}
<div class="output">
<h2>Extracted Text</h2>
<p>{{ text }}</p>
</div>
{% endif %}
</div>
</body>
</html>