Athspi commited on
Commit
2faebb6
·
verified ·
1 Parent(s): 74d8a08

Update templates/index.html

Browse files
Files changed (1) hide show
  1. templates/index.html +269 -45
templates/index.html CHANGED
@@ -3,63 +3,287 @@
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>AI Video Dubbing</title>
 
 
 
7
  <style>
8
- body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; margin: 0; background-color: #f0f2f5; display: flex; justify-content: center; align-items: center; min-height: 100vh; }
9
- .container { background-color: #fff; padding: 2rem; border-radius: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); width: 100%; max-width: 600px; }
10
- h1 { text-align: center; color: #1c1e21; }
11
- form { display: flex; flex-direction: column; gap: 1.5rem; }
12
- .form-group { display: flex; flex-direction: column; }
13
- label { margin-bottom: 0.5rem; font-weight: 600; color: #4b4f56; }
14
- input[type="file"] { border: 1px solid #dddfe2; padding: 0.75rem; border-radius: 6px; }
15
- .radio-group label { display: inline-block; margin-right: 1rem; }
16
- input[type="submit"] { background-color: #1877f2; color: white; border: none; padding: 0.75rem 1.5rem; border-radius: 6px; font-size: 1rem; font-weight: 600; cursor: pointer; transition: background-color 0.2s; }
17
- input[type="submit"]:hover { background-color: #166fe5; }
18
- .result-section { margin-top: 2rem; border-top: 1px solid #dddfe2; padding-top: 2rem; }
19
- h2 { color: #1c1e21; }
20
- video { width: 100%; border-radius: 8px; }
21
- .script-box { background-color: #f0f2f5; border: 1px solid #dddfe2; padding: 1rem; border-radius: 6px; white-space: pre-wrap; font-family: "Courier New", Courier, monospace; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  </style>
23
  </head>
24
  <body>
25
  <div class="container">
26
- <h1>AI Single-Speaker Video Dubbing</h1>
27
- <form action="/process" method="POST" enctype="multipart/form-data">
28
- <div class="form-group">
29
- <label for="video">Upload Video File:</label>
30
- <input type="file" id="video" name="video" accept="video/*" required>
31
- </div>
32
 
33
- <div class="form-group radio-group">
34
- <label>Select Narrator Voice:</label>
35
- <div>
36
- <label><input type="radio" name="voice_choice" value="Male (Charon)" checked> Male (Charon)</label>
37
- <label><input type="radio" name="voice_choice" value="Female (Zephyr)"> Female (Zephyr)</label>
38
- </div>
39
- </div>
 
 
 
 
40
 
41
- <div class="form-group">
42
- <label><input type="checkbox" name="cheerful"> Enable Cheerful Tone</label>
43
- </div>
 
 
 
 
44
 
45
- <input type="submit" value="Generate Dubbed Video">
46
- </form>
 
47
 
48
- {% if result_video %}
49
- <div class="result-section">
50
- <h2>Dubbed Video</h2>
51
- <video controls>
52
- <source src="{{ result_video }}" type="video/mp4">
53
- Your browser does not support the video tag.
54
- </video>
55
 
56
- <h2>Generated Script</h2>
57
- <div class="script-box">
58
- {{ script }}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  </div>
60
  </div>
61
- {% endif %}
62
-
63
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
  </body>
65
  </html>
 
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>AI Video Dubbing Studio</title>
7
+ <link rel="preconnect" href="https://fonts.googleapis.com">
8
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
9
+ <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap" rel="stylesheet">
10
  <style>
11
+ :root {
12
+ --bg-color: #121212;
13
+ --surface-color: #1e1e1e;
14
+ --primary-color: #3498db;
15
+ --primary-hover-color: #2980b9;
16
+ --text-color: #e0e0e0;
17
+ --text-secondary-color: #a0a0a0;
18
+ --border-color: #333;
19
+ --error-bg: #4e3434;
20
+ --error-border: #d32f2f;
21
+ }
22
+
23
+ * { box-sizing: border-box; margin: 0; padding: 0; }
24
+
25
+ body {
26
+ font-family: 'Poppins', sans-serif;
27
+ background-color: var(--bg-color);
28
+ color: var(--text-color);
29
+ display: flex;
30
+ justify-content: center;
31
+ align-items: flex-start;
32
+ min-height: 100vh;
33
+ padding: 2rem;
34
+ }
35
+
36
+ .container {
37
+ width: 100%;
38
+ max-width: 1200px;
39
+ }
40
+
41
+ header h1 {
42
+ font-size: 2.5rem;
43
+ font-weight: 700;
44
+ text-align: center;
45
+ margin-bottom: 0.5rem;
46
+ color: #fff;
47
+ }
48
+
49
+ header p {
50
+ text-align: center;
51
+ color: var(--text-secondary-color);
52
+ margin-bottom: 2.5rem;
53
+ max-width: 600px;
54
+ margin-left: auto;
55
+ margin-right: auto;
56
+ }
57
+
58
+ .main-content {
59
+ display: flex;
60
+ gap: 2rem;
61
+ }
62
+
63
+ .form-container, .result-container {
64
+ background-color: var(--surface-color);
65
+ padding: 2rem;
66
+ border-radius: 12px;
67
+ border: 1px solid var(--border-color);
68
+ }
69
+
70
+ .form-container {
71
+ flex: 1;
72
+ }
73
+
74
+ .result-container {
75
+ flex: 1.5;
76
+ display: {% if result_video or get_flashed_messages() %}block{% else %}none{% endif %};
77
+ }
78
+
79
+ .form-group {
80
+ margin-bottom: 1.5rem;
81
+ }
82
+
83
+ label {
84
+ display: block;
85
+ font-weight: 500;
86
+ margin-bottom: 0.5rem;
87
+ color: var(--text-secondary-color);
88
+ }
89
+
90
+ /* Custom File Input */
91
+ .file-input-wrapper {
92
+ position: relative;
93
+ display: inline-block;
94
+ width: 100%;
95
+ cursor: pointer;
96
+ }
97
+ .file-input-button {
98
+ background-color: var(--primary-color);
99
+ color: white;
100
+ padding: 0.75rem 1rem;
101
+ border-radius: 6px;
102
+ text-align: center;
103
+ transition: background-color 0.2s;
104
+ }
105
+ .file-input-wrapper:hover .file-input-button {
106
+ background-color: var(--primary-hover-color);
107
+ }
108
+ .file-input-wrapper input[type="file"] {
109
+ position: absolute;
110
+ left: 0;
111
+ top: 0;
112
+ opacity: 0;
113
+ width: 100%;
114
+ height: 100%;
115
+ cursor: pointer;
116
+ }
117
+ #file-name {
118
+ margin-top: 0.5rem;
119
+ font-style: italic;
120
+ color: var(--text-secondary-color);
121
+ }
122
+
123
+ .radio-group label {
124
+ display: inline-block;
125
+ margin-right: 1.5rem;
126
+ color: var(--text-color);
127
+ }
128
+
129
+ .submit-button {
130
+ width: 100%;
131
+ background-color: var(--primary-color);
132
+ color: white;
133
+ border: none;
134
+ padding: 0.85rem;
135
+ border-radius: 6px;
136
+ font-size: 1.1rem;
137
+ font-weight: 600;
138
+ cursor: pointer;
139
+ transition: background-color 0.2s;
140
+ display: flex;
141
+ justify-content: center;
142
+ align-items: center;
143
+ gap: 0.5rem;
144
+ }
145
+ .submit-button:hover { background-color: var(--primary-hover-color); }
146
+ .submit-button:disabled { background-color: #555; cursor: not-allowed; }
147
+
148
+ .spinner {
149
+ border: 3px solid rgba(255, 255, 255, 0.3);
150
+ border-radius: 50%;
151
+ border-top: 3px solid #fff;
152
+ width: 16px;
153
+ height: 16px;
154
+ animation: spin 1s linear infinite;
155
+ display: none; /* Hidden by default */
156
+ }
157
+ @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
158
+
159
+ .result-container h2 {
160
+ margin-bottom: 1rem;
161
+ border-bottom: 1px solid var(--border-color);
162
+ padding-bottom: 0.5rem;
163
+ }
164
+ .result-container video {
165
+ width: 100%;
166
+ border-radius: 8px;
167
+ margin-bottom: 1.5rem;
168
+ }
169
+ .script-box {
170
+ background-color: var(--bg-color);
171
+ border: 1px solid var(--border-color);
172
+ padding: 1rem;
173
+ border-radius: 6px;
174
+ white-space: pre-wrap;
175
+ word-wrap: break-word;
176
+ font-family: "Courier New", Courier, monospace;
177
+ max-height: 200px;
178
+ overflow-y: auto;
179
+ }
180
+
181
+ /* Flash Messages (Errors) */
182
+ .flash-error {
183
+ padding: 1rem;
184
+ margin-bottom: 1rem;
185
+ border-radius: 6px;
186
+ background-color: var(--error-bg);
187
+ border: 1px solid var(--error-border);
188
+ color: #fdd835;
189
+ }
190
+
191
+ /* Responsive Design */
192
+ @media (max-width: 900px) {
193
+ .main-content { flex-direction: column; }
194
+ .result-container { margin-top: 2rem; }
195
+ }
196
  </style>
197
  </head>
198
  <body>
199
  <div class="container">
200
+ <header>
201
+ <h1>AI Video Dubbing Studio</h1>
202
+ <p>Upload a video, choose a voice, and let the AI generate a new, expressive Tamil voiceover. The original audio will be replaced entirely.</p>
203
+ </header>
 
 
204
 
205
+ <div class="main-content">
206
+ <div class="form-container">
207
+ <form id="dubbing-form" action="/process" method="POST" enctype="multipart/form-data">
208
+ <div class="form-group">
209
+ <label>1. Upload Video File</label>
210
+ <div class="file-input-wrapper">
211
+ <div class="file-input-button">Choose Video...</div>
212
+ <input type="file" id="video" name="video" accept="video/*" required>
213
+ </div>
214
+ <div id="file-name">No file selected.</div>
215
+ </div>
216
 
217
+ <div class="form-group radio-group">
218
+ <label>2. Select Narrator Voice</label>
219
+ <div>
220
+ <label><input type="radio" name="voice_choice" value="Male (Charon)" checked> Male (Charon)</label>
221
+ <label><input type="radio" name="voice_choice" value="Female (Zephyr)"> Female (Zephyr)</label>
222
+ </div>
223
+ </div>
224
 
225
+ <div class="form-group">
226
+ <label><input type="checkbox" name="cheerful"> 3. Enable Cheerful Tone</label>
227
+ </div>
228
 
229
+ <button type="submit" class="submit-button" id="submit-btn">
230
+ <span id="button-text">Generate Dubbed Video</span>
231
+ <div class="spinner" id="spinner"></div>
232
+ </button>
233
+ </form>
234
+ </div>
 
235
 
236
+ <div class="result-container">
237
+ {% with messages = get_flashed_messages(with_categories=true) %}
238
+ {% if messages %}
239
+ {% for category, message in messages %}
240
+ <div class="flash-{{ category }}">{{ message }}</div>
241
+ {% endfor %}
242
+ {% endif %}
243
+ {% endwith %}
244
+
245
+ {% if result_video %}
246
+ <h2>Dubbed Video</h2>
247
+ <video controls autoplay>
248
+ <source src="{{ result_video }}" type="video/mp4">
249
+ Your browser does not support the video tag.
250
+ </video>
251
+
252
+ <h2>Generated Script</h2>
253
+ <div class="script-box">
254
+ {{ script }}
255
+ </div>
256
+ {% endif %}
257
  </div>
258
  </div>
 
 
259
  </div>
260
+
261
+ <script>
262
+ const form = document.getElementById('dubbing-form');
263
+ const submitBtn = document.getElementById('submit-btn');
264
+ const buttonText = document.getElementById('button-text');
265
+ const spinner = document.getElementById('spinner');
266
+ const fileInput = document.getElementById('video');
267
+ const fileNameDisplay = document.getElementById('file-name');
268
+
269
+ fileInput.addEventListener('change', () => {
270
+ if (fileInput.files.length > 0) {
271
+ fileNameDisplay.textContent = fileInput.files[0].name;
272
+ } else {
273
+ fileNameDisplay.textContent = 'No file selected.';
274
+ }
275
+ });
276
+
277
+ form.addEventListener('submit', () => {
278
+ // Check if a file is selected
279
+ if (fileInput.files.length === 0) {
280
+ // The 'required' attribute will handle the alert
281
+ return;
282
+ }
283
+ submitBtn.disabled = true;
284
+ buttonText.textContent = 'Processing...';
285
+ spinner.style.display = 'block';
286
+ });
287
+ </script>
288
  </body>
289
  </html>