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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>AutoSubGen Pro - AI Video Subtitle Generator</title>
|
| 7 |
+
<style>
|
| 8 |
+
body {
|
| 9 |
+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
| 10 |
+
line-height: 1.6;
|
| 11 |
+
background-color: #f7f7f7;
|
| 12 |
+
color: #333;
|
| 13 |
+
margin: 0;
|
| 14 |
+
padding: 20px;
|
| 15 |
+
}
|
| 16 |
+
.container {
|
| 17 |
+
max-width: 800px;
|
| 18 |
+
margin: 0 auto;
|
| 19 |
+
background-color: #fff;
|
| 20 |
+
padding: 30px;
|
| 21 |
+
border-radius: 10px;
|
| 22 |
+
box-shadow: 0 4px 15px rgba(0,0,0,0.1);
|
| 23 |
+
}
|
| 24 |
+
h1, h2 {
|
| 25 |
+
text-align: center;
|
| 26 |
+
color: #444;
|
| 27 |
+
}
|
| 28 |
+
h1 {
|
| 29 |
+
font-size: 2.5em;
|
| 30 |
+
margin-bottom: 5px;
|
| 31 |
+
}
|
| 32 |
+
h2 {
|
| 33 |
+
font-size: 1.2em;
|
| 34 |
+
font-weight: 300;
|
| 35 |
+
margin-top: 0;
|
| 36 |
+
margin-bottom: 30px;
|
| 37 |
+
}
|
| 38 |
+
form {
|
| 39 |
+
display: flex;
|
| 40 |
+
flex-direction: column;
|
| 41 |
+
gap: 20px;
|
| 42 |
+
}
|
| 43 |
+
.form-group {
|
| 44 |
+
border: 1px solid #ddd;
|
| 45 |
+
padding: 20px;
|
| 46 |
+
border-radius: 8px;
|
| 47 |
+
}
|
| 48 |
+
label {
|
| 49 |
+
display: block;
|
| 50 |
+
margin-bottom: 8px;
|
| 51 |
+
font-weight: 600;
|
| 52 |
+
color: #555;
|
| 53 |
+
}
|
| 54 |
+
input[type="file"], select {
|
| 55 |
+
width: 100%;
|
| 56 |
+
padding: 10px;
|
| 57 |
+
border: 1px solid #ccc;
|
| 58 |
+
border-radius: 5px;
|
| 59 |
+
box-sizing: border-box;
|
| 60 |
+
}
|
| 61 |
+
.checkbox-group {
|
| 62 |
+
display: flex;
|
| 63 |
+
align-items: center;
|
| 64 |
+
gap: 10px;
|
| 65 |
+
}
|
| 66 |
+
input[type="checkbox"] {
|
| 67 |
+
width: 18px;
|
| 68 |
+
height: 18px;
|
| 69 |
+
}
|
| 70 |
+
button {
|
| 71 |
+
background-color: #007bff;
|
| 72 |
+
color: white;
|
| 73 |
+
padding: 12px 20px;
|
| 74 |
+
border: none;
|
| 75 |
+
border-radius: 5px;
|
| 76 |
+
cursor: pointer;
|
| 77 |
+
font-size: 1.1em;
|
| 78 |
+
font-weight: 600;
|
| 79 |
+
transition: background-color 0.3s;
|
| 80 |
+
}
|
| 81 |
+
button:hover {
|
| 82 |
+
background-color: #0056b3;
|
| 83 |
+
}
|
| 84 |
+
#loader {
|
| 85 |
+
display: none;
|
| 86 |
+
text-align: center;
|
| 87 |
+
padding: 20px;
|
| 88 |
+
font-size: 1.2em;
|
| 89 |
+
}
|
| 90 |
+
#results {
|
| 91 |
+
margin-top: 30px;
|
| 92 |
+
border-top: 1px solid #eee;
|
| 93 |
+
padding-top: 20px;
|
| 94 |
+
}
|
| 95 |
+
.result-item {
|
| 96 |
+
background-color: #e9f5ff;
|
| 97 |
+
border: 1px solid #b3d7ff;
|
| 98 |
+
padding: 15px;
|
| 99 |
+
margin-bottom: 15px;
|
| 100 |
+
border-radius: 5px;
|
| 101 |
+
}
|
| 102 |
+
.result-item h3 {
|
| 103 |
+
margin-top: 0;
|
| 104 |
+
color: #0056b3;
|
| 105 |
+
}
|
| 106 |
+
.result-item a {
|
| 107 |
+
display: inline-block;
|
| 108 |
+
background-color: #28a745;
|
| 109 |
+
color: white;
|
| 110 |
+
padding: 8px 15px;
|
| 111 |
+
text-decoration: none;
|
| 112 |
+
border-radius: 5px;
|
| 113 |
+
transition: background-color 0.3s;
|
| 114 |
+
}
|
| 115 |
+
.result-item a:hover {
|
| 116 |
+
background-color: #218838;
|
| 117 |
+
}
|
| 118 |
+
.result-item video, .result-item audio {
|
| 119 |
+
width: 100%;
|
| 120 |
+
margin-top: 10px;
|
| 121 |
+
border-radius: 5px;
|
| 122 |
+
}
|
| 123 |
+
.error {
|
| 124 |
+
color: #D8000C;
|
| 125 |
+
background-color: #FFD2D2;
|
| 126 |
+
border: 1px solid #D8000C;
|
| 127 |
+
padding: 15px;
|
| 128 |
+
margin-bottom: 20px;
|
| 129 |
+
border-radius: 5px;
|
| 130 |
+
text-align: center;
|
| 131 |
+
}
|
| 132 |
+
</style>
|
| 133 |
+
</head>
|
| 134 |
+
<body>
|
| 135 |
+
<div class="container">
|
| 136 |
+
<h1>🎥 AutoSubGen Pro</h1>
|
| 137 |
+
<h2>AI-Powered Video Subtitle Generator</h2>
|
| 138 |
+
|
| 139 |
+
{% with messages = get_flashed_messages(with_categories=true) %}
|
| 140 |
+
{% if messages %}
|
| 141 |
+
{% for category, message in messages %}
|
| 142 |
+
<div class="error">{{ message }}</div>
|
| 143 |
+
{% endfor %}
|
| 144 |
+
{% endif %}
|
| 145 |
+
{% endwith %}
|
| 146 |
+
|
| 147 |
+
<form id="upload-form" action="{{ url_for('process') }}" method="post" enctype="multipart/form-data">
|
| 148 |
+
<div class="form-group">
|
| 149 |
+
<label for="video">1. Upload Your Video File</label>
|
| 150 |
+
<input type="file" id="video" name="video" accept="video/*" required>
|
| 151 |
+
</div>
|
| 152 |
+
|
| 153 |
+
<div class="form-group">
|
| 154 |
+
<label for="language_dropdown">2. Select Video Language (or let AI detect it)</label>
|
| 155 |
+
<select id="language_dropdown" name="source_language">
|
| 156 |
+
{% for lang in supported_languages %}
|
| 157 |
+
<option value="{{ lang }}">{{ lang }}</option>
|
| 158 |
+
{% endfor %}
|
| 159 |
+
</select>
|
| 160 |
+
</div>
|
| 161 |
+
|
| 162 |
+
<div class="form-group">
|
| 163 |
+
<label for="translate_to_dropdown">3. (Optional) Translate Subtitles To:</label>
|
| 164 |
+
<select id="translate_to_dropdown" name="translate_to">
|
| 165 |
+
<option value="None">None</option>
|
| 166 |
+
{% for lang in supported_languages[1:] %}
|
| 167 |
+
<option value="{{ lang }}">{{ lang }}</option>
|
| 168 |
+
{% endfor %}
|
| 169 |
+
</select>
|
| 170 |
+
</div>
|
| 171 |
+
|
| 172 |
+
<div class="form-group">
|
| 173 |
+
<label>4. (Optional) Additional Outputs</label>
|
| 174 |
+
<div class="checkbox-group">
|
| 175 |
+
<input type="checkbox" id="tts_checkbox" name="add_tts">
|
| 176 |
+
<label for="tts_checkbox">Generate Text-to-Speech Audio of Subtitles</label>
|
| 177 |
+
</div>
|
| 178 |
+
<div class="checkbox-group">
|
| 179 |
+
<input type="checkbox" id="subtitles_checkbox" name="add_subtitles">
|
| 180 |
+
<label for="subtitles_checkbox">Add Subtitles to Video (burn-in)</label>
|
| 181 |
+
</div>
|
| 182 |
+
</div>
|
| 183 |
+
|
| 184 |
+
<button type="submit">Process Video</button>
|
| 185 |
+
</form>
|
| 186 |
+
|
| 187 |
+
<div id="loader">
|
| 188 |
+
<p>Processing your video... This may take a few minutes.</p>
|
| 189 |
+
<img src="https://i.gifer.com/ZKZg.gif" alt="Loading..." width="50">
|
| 190 |
+
</div>
|
| 191 |
+
|
| 192 |
+
{% if results %}
|
| 193 |
+
<div id="results">
|
| 194 |
+
<h2>Processing Complete!</h2>
|
| 195 |
+
{% if results.detected_language %}
|
| 196 |
+
<div class="result-item">
|
| 197 |
+
<h3>Detected Language</h3>
|
| 198 |
+
<p>{{ results.detected_language }}</p>
|
| 199 |
+
</div>
|
| 200 |
+
{% endif %}
|
| 201 |
+
|
| 202 |
+
{% if results.original_srt_file %}
|
| 203 |
+
<div class="result-item">
|
| 204 |
+
<h3>Original Subtitles (SRT)</h3>
|
| 205 |
+
<a href="{{ url_for('download_file', session_id=session_id, filename=results.original_srt_file) }}" download>Download Original SRT</a>
|
| 206 |
+
</div>
|
| 207 |
+
{% endif %}
|
| 208 |
+
|
| 209 |
+
{% if results.translated_srt_file %}
|
| 210 |
+
<div class="result-item">
|
| 211 |
+
<h3>Translated Subtitles (SRT)</h3>
|
| 212 |
+
<a href="{{ url_for('download_file', session_id=session_id, filename=results.translated_srt_file) }}" download>Download Translated SRT</a>
|
| 213 |
+
</div>
|
| 214 |
+
{% endif %}
|
| 215 |
+
|
| 216 |
+
{% if results.tts_audio_file %}
|
| 217 |
+
<div class="result-item">
|
| 218 |
+
<h3>Text-to-Speech Audio</h3>
|
| 219 |
+
<audio controls src="{{ url_for('download_file', session_id=session_id, filename=results.tts_audio_file) }}"></audio>
|
| 220 |
+
<br>
|
| 221 |
+
<a href="{{ url_for('download_file', session_id=session_id, filename=results.tts_audio_file) }}" download>Download TTS Audio (MP3)</a>
|
| 222 |
+
</div>
|
| 223 |
+
{% endif %}
|
| 224 |
+
|
| 225 |
+
{% if results.output_video_file %}
|
| 226 |
+
<div class="result-item">
|
| 227 |
+
<h3>Video with Subtitles</h3>
|
| 228 |
+
<video controls src="{{ url_for('download_file', session_id=session_id, filename=results.output_video_file) }}"></video>
|
| 229 |
+
<br>
|
| 230 |
+
<a href="{{ url_for('download_file', session_id=session_id, filename=results.output_video_file) }}" download>Download Final Video (MP4)</a>
|
| 231 |
+
</div>
|
| 232 |
+
{% endif %}
|
| 233 |
+
</div>
|
| 234 |
+
{% endif %}
|
| 235 |
+
|
| 236 |
+
</div>
|
| 237 |
+
|
| 238 |
+
<script>
|
| 239 |
+
document.getElementById('upload-form').addEventListener('submit', function() {
|
| 240 |
+
document.getElementById('loader').style.display = 'block';
|
| 241 |
+
});
|
| 242 |
+
</script>
|
| 243 |
+
</body>
|
| 244 |
+
</html>
|