File size: 2,165 Bytes
384cf9d
81bb8d5
ffda1f9
 
 
2e63e48
de8a037
4fd0ec2
ffda1f9
 
81bb8d5
2e63e48
 
 
 
 
 
 
 
 
 
de8a037
2e63e48
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81bb8d5
a30f0d6
ffda1f9
de8a037
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
49
50
51
52
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>AI Question Answering | Ask Questions on Documents and Images</title>
    <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="/static/styles.css" rel="stylesheet"> <!-- Linking CSS file -->
</head>
<body>
    <div class="container">
        <h1 class="text-center my-5">AI Question Answering</h1>
        
        <form action="/question-answering-doc" method="POST" enctype="multipart/form-data">
            <div class="mb-3">
                <label for="file" class="form-label">Choose Document (PDF, DOCX, PPTX)</label>
                <input type="file" class="form-control" name="file" required>
            </div>
            <div class="mb-3">
                <label for="question" class="form-label">Enter Your Question</label>
                <input type="text" class="form-control" name="question" required>
            </div>
            <button type="submit" class="btn btn-primary">Submit Question</button>
        </form>
        
        <form action="/question-answering-image" method="POST" enctype="multipart/form-data" class="mt-5">
            <div class="mb-3">
                <label for="image" class="form-label">Choose Image (JPG, PNG)</label>
                <input type="file" class="form-control" name="image_file" required>
            </div>
            <div class="mb-3">
                <label for="image-question" class="form-label">Enter Your Question</label>
                <input type="text" class="form-control" name="question" required>
            </div>
            <button type="submit" class="btn btn-primary">Submit Question</button>
        </form>

        <div class="mt-4">
            {% if answer %}
                <h3>Answer:</h3>
                <p>{{ answer }}</p>
            {% endif %}
            
            {% if image_text %}
                <h3>Image Text (OCR Result):</h3>
                <p>{{ image_text }}</p>
            {% endif %}
        </div>
    </div>
</body>
</html>