File size: 1,625 Bytes
93c87da
 
 
 
0bd0f00
93c87da
0bd0f00
e302e06
93c87da
 
0bd0f00
 
93c87da
0bd0f00
 
 
 
 
 
 
93c87da
 
0bd0f00
 
 
 
 
93c87da
 
0bd0f00
93c87da
0bd0f00
 
93c87da
 
e302e06
0bd0f00
 
e302e06
 
 
0bd0f00
93c87da
 
0bd0f00
93c87da
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>OCR App</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.1.0/css/bootstrap.min.css">
    <link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
</head>
<body>
    <div class="container mt-5">
        <h1>OCR Application</h1>

        <!-- Form to upload file -->
        <form method="post" enctype="multipart/form-data">
            <div class="mb-3">
                <label for="file" class="form-label">Choose a file</label>
                <input type="file" class="form-control" name="file" id="file" required>
            </div>
            <button type="submit" class="btn btn-primary">Upload</button>
        </form>

        <!-- Error Message Display -->
        {% if error %}
            <div class="alert alert-danger mt-3" role="alert">
                {{ error }}
            </div>
        {% endif %}

        <!-- Display OCR Result -->
        {% if text %}
            <h3 class="mt-4">Extracted Text:</h3>
            <pre>{{ text }}</pre>
        {% endif %}

        <!-- Display Image -->
        {% if filename %}
            <h4>Uploaded Image: {{ filename }}</h4>
            <div class="image-preview">
                <img src="{{ url_for('uploaded_file', filename=filename) }}" alt="Uploaded Image">
            </div>
        {% endif %}
    </div>

    <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.1.0/js/bootstrap.bundle.min.js"></script>
</body>
</html>