File size: 4,903 Bytes
ec29974
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>File Analysis</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css" rel="stylesheet">
    <style>

        body {

            background-color: #f8f9fa;

            font-family: 'Arial', sans-serif;

        }

        .container {

            margin-top: 50px;

            margin-bottom: 50px;

            border-radius: 10px;

            background: white;

            padding: 30px;

            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);

        }

        h2, h3 {

            color: #343a40;

            margin-bottom: 20px;

        }

        .form-control, .form-select {

            margin-bottom: 15px;

            border-radius: 8px;

            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);

        }

        .form-control:focus, .form-select:focus {

            border-color: #007bff;

            box-shadow: 0 0 5px rgba(0, 123, 255, 0.5);

        }

        .btn {

            border-radius: 8px;

            transition: background-color 0.3s ease, transform 0.2s ease;

        }

        .btn-primary {

            background-color: #0d6efd;

            border: none;

        }

        .btn-primary:hover {

            background-color: #0b5ed7;

            transform: translateY(-2px);

        }

        .btn-secondary {

            background-color: #6c757d;

            border: none;

        }

        .btn-secondary:hover {

            background-color: #5a6268;

            transform: translateY(-2px);

        }

        .summary {

            background-color: #ffffff;

            padding: 20px;

            border-radius: 8px;

            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);

            margin-top: 20px;

        }

        .list-group-item {

            background-color: #ffffff;

            border: 1px solid #dee2e6;

            border-radius: 8px;

            margin-bottom: 10px;

        }

        .list-group-item:hover {

            background-color: #f1f1f1;

        }

        .conversation-history {

            margin-top: 20px;

        }

    </style>
</head>
<body>

<div class="container">
    <h2 class="text-center">File Analysis</h2>

    {% if not summary %}
    <form action="/" method="post" enctype="multipart/form-data" class="bg-light p-4 border rounded shadow-sm">
        <h5>Upload File</h5>
        <input type="file" name="file" accept=".pdf,.pptx,.csv,.xlsx,.mp3,.docx" class="form-control">

        <label>Select Summary Length:</label>
        <select name="summary_length" class="form-select">
            <option value="2 sentences">Short</option>
            <option value="5 sentences">Medium</option>
            <option value="10 sentences">Long</option>
        </select>
        <br>

        <label>Who are you?</label>
        <input type="text" name="iam" id="iam" class="form-control" required>

        <label>What's the document context about?</label>
        <input type="text" name="context" id="context" class="form-control" required>

        <label>Output Expectation (What you want to analyze?)</label>
        <input type="text" name="output" id="output" class="form-control" required>

        <label>Input your Google Gemini API Key</label>
        <input type="text" name="api_key" id="api_key" class="form-control">

        <input type="submit" value="Analyze" class="btn btn-primary mt-3">
    </form>
    {% endif %}

    {% if summary %}
    <div class="summary">
        <h3>Summary:</h3>
        <p>{{ summary|safe }}</p>

        {% if show_conversation %}
        <h3>Conversation</h3>
        <form action="/ask" method="post" class="mb-3">
            <input type="text" name="question" class="form-control" placeholder="Ask your question">
            <input type="submit" value="Ask" class="btn btn-secondary mt-2">
        </form>
        {% endif %}
    </div>
    {% endif %}

    {% if question_responses %}
    <br>
    <h3>Conversation History:</h3>
    <ul class="list-group conversation-history">
        {% for question, response in question_responses %}
        <li class="list-group-item">
            <strong>Question:</strong> {{ question }}<br>
            <strong>Response:</strong> {{ response|safe }}
        </li>
        {% endfor %}
    </ul>
    {% endif %}
</div>

<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.6/dist/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/5.3.0/js/bootstrap.min.js"></script>
</body>
</html>