File size: 8,422 Bytes
12ef355
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>AutoSubGen Pro - AI Video Subtitle Generator</title>
    <style>
        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
            line-height: 1.6;
            background-color: #f7f7f7;
            color: #333;
            margin: 0;
            padding: 20px;
        }
        .container {
            max-width: 800px;
            margin: 0 auto;
            background-color: #fff;
            padding: 30px;
            border-radius: 10px;
            box-shadow: 0 4px 15px rgba(0,0,0,0.1);
        }
        h1, h2 {
            text-align: center;
            color: #444;
        }
        h1 {
            font-size: 2.5em;
            margin-bottom: 5px;
        }
        h2 {
            font-size: 1.2em;
            font-weight: 300;
            margin-top: 0;
            margin-bottom: 30px;
        }
        form {
            display: flex;
            flex-direction: column;
            gap: 20px;
        }
        .form-group {
            border: 1px solid #ddd;
            padding: 20px;
            border-radius: 8px;
        }
        label {
            display: block;
            margin-bottom: 8px;
            font-weight: 600;
            color: #555;
        }
        input[type="file"], select {
            width: 100%;
            padding: 10px;
            border: 1px solid #ccc;
            border-radius: 5px;
            box-sizing: border-box;
        }
        .checkbox-group {
            display: flex;
            align-items: center;
            gap: 10px;
        }
        input[type="checkbox"] {
            width: 18px;
            height: 18px;
        }
        button {
            background-color: #007bff;
            color: white;
            padding: 12px 20px;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            font-size: 1.1em;
            font-weight: 600;
            transition: background-color 0.3s;
        }
        button:hover {
            background-color: #0056b3;
        }
        #loader {
            display: none;
            text-align: center;
            padding: 20px;
            font-size: 1.2em;
        }
        #results {
            margin-top: 30px;
            border-top: 1px solid #eee;
            padding-top: 20px;
        }
        .result-item {
            background-color: #e9f5ff;
            border: 1px solid #b3d7ff;
            padding: 15px;
            margin-bottom: 15px;
            border-radius: 5px;
        }
        .result-item h3 {
            margin-top: 0;
            color: #0056b3;
        }
        .result-item a {
            display: inline-block;
            background-color: #28a745;
            color: white;
            padding: 8px 15px;
            text-decoration: none;
            border-radius: 5px;
            transition: background-color 0.3s;
        }
        .result-item a:hover {
            background-color: #218838;
        }
        .result-item video, .result-item audio {
            width: 100%;
            margin-top: 10px;
            border-radius: 5px;
        }
        .error {
            color: #D8000C;
            background-color: #FFD2D2;
            border: 1px solid #D8000C;
            padding: 15px;
            margin-bottom: 20px;
            border-radius: 5px;
            text-align: center;
        }
    </style>
</head>
<body>
    <div class="container">
        <h1>🎥 AutoSubGen Pro</h1>
        <h2>AI-Powered Video Subtitle Generator</h2>

        {% with messages = get_flashed_messages(with_categories=true) %}
            {% if messages %}
                {% for category, message in messages %}
                    <div class="error">{{ message }}</div>
                {% endfor %}
            {% endif %}
        {% endwith %}

        <form id="upload-form" action="{{ url_for('process') }}" method="post" enctype="multipart/form-data">
            <div class="form-group">
                <label for="video">1. Upload Your Video File</label>
                <input type="file" id="video" name="video" accept="video/*" required>
            </div>

            <div class="form-group">
                <label for="language_dropdown">2. Select Video Language (or let AI detect it)</label>
                <select id="language_dropdown" name="source_language">
                    {% for lang in supported_languages %}
                        <option value="{{ lang }}">{{ lang }}</option>
                    {% endfor %}
                </select>
            </div>

            <div class="form-group">
                <label for="translate_to_dropdown">3. (Optional) Translate Subtitles To:</label>
                <select id="translate_to_dropdown" name="translate_to">
                    <option value="None">None</option>
                     {% for lang in supported_languages[1:] %}
                        <option value="{{ lang }}">{{ lang }}</option>
                    {% endfor %}
                </select>
            </div>

            <div class="form-group">
                <label>4. (Optional) Additional Outputs</label>
                <div class="checkbox-group">
                    <input type="checkbox" id="tts_checkbox" name="add_tts">
                    <label for="tts_checkbox">Generate Text-to-Speech Audio of Subtitles</label>
                </div>
                <div class="checkbox-group">
                    <input type="checkbox" id="subtitles_checkbox" name="add_subtitles">
                    <label for="subtitles_checkbox">Add Subtitles to Video (burn-in)</label>
                </div>
            </div>

            <button type="submit">Process Video</button>
        </form>

        <div id="loader">
            <p>Processing your video... This may take a few minutes.</p>
            <img src="https://i.gifer.com/ZKZg.gif" alt="Loading..." width="50">
        </div>

        {% if results %}
        <div id="results">
            <h2>Processing Complete!</h2>
            {% if results.detected_language %}
                <div class="result-item">
                    <h3>Detected Language</h3>
                    <p>{{ results.detected_language }}</p>
                </div>
            {% endif %}

            {% if results.original_srt_file %}
                <div class="result-item">
                    <h3>Original Subtitles (SRT)</h3>
                    <a href="{{ url_for('download_file', session_id=session_id, filename=results.original_srt_file) }}" download>Download Original SRT</a>
                </div>
            {% endif %}

            {% if results.translated_srt_file %}
                <div class="result-item">
                    <h3>Translated Subtitles (SRT)</h3>
                     <a href="{{ url_for('download_file', session_id=session_id, filename=results.translated_srt_file) }}" download>Download Translated SRT</a>
                </div>
            {% endif %}

             {% if results.tts_audio_file %}
                <div class="result-item">
                    <h3>Text-to-Speech Audio</h3>
                    <audio controls src="{{ url_for('download_file', session_id=session_id, filename=results.tts_audio_file) }}"></audio>
                    <br>
                    <a href="{{ url_for('download_file', session_id=session_id, filename=results.tts_audio_file) }}" download>Download TTS Audio (MP3)</a>
                </div>
            {% endif %}

            {% if results.output_video_file %}
                 <div class="result-item">
                    <h3>Video with Subtitles</h3>
                    <video controls src="{{ url_for('download_file', session_id=session_id, filename=results.output_video_file) }}"></video>
                     <br>
                    <a href="{{ url_for('download_file', session_id=session_id, filename=results.output_video_file) }}" download>Download Final Video (MP4)</a>
                </div>
            {% endif %}
        </div>
        {% endif %}

    </div>

    <script>
        document.getElementById('upload-form').addEventListener('submit', function() {
            document.getElementById('loader').style.display = 'block';
        });
    </script>
</body>
</html>