Update templates/index.html
Browse files- templates/index.html +88 -40
templates/index.html
CHANGED
@@ -5,26 +5,29 @@
|
|
5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
<title>AI Video Narrator</title>
|
7 |
<style>
|
8 |
-
@import url('https://fonts.googleapis.com/css2?family=
|
9 |
|
10 |
:root {
|
11 |
--primary-color: #0d6efd;
|
12 |
-
--
|
13 |
--background-color: #f8f9fa;
|
14 |
--card-background: #ffffff;
|
15 |
-
--text-color: #495057;
|
16 |
--heading-color: #212529;
|
17 |
--border-color: #dee2e6;
|
18 |
-
--shadow: 0 8px 30px rgba(0,0,0,0.
|
|
|
|
|
|
|
|
|
19 |
}
|
20 |
|
21 |
body {
|
22 |
-
font-family: '
|
23 |
margin: 0;
|
24 |
background-color: var(--background-color);
|
25 |
display: flex;
|
26 |
justify-content: center;
|
27 |
-
align-items:
|
28 |
padding: 2rem;
|
29 |
min-height: 100vh;
|
30 |
}
|
@@ -32,78 +35,104 @@
|
|
32 |
background-color: var(--card-background);
|
33 |
padding: 2.5rem 3rem;
|
34 |
border-radius: 20px;
|
|
|
35 |
box-shadow: var(--shadow);
|
36 |
width: 100%;
|
37 |
-
max-width:
|
38 |
transition: all 0.3s ease;
|
39 |
}
|
|
|
40 |
h1 {
|
41 |
-
text-align: center;
|
42 |
color: var(--heading-color);
|
43 |
font-weight: 700;
|
44 |
margin-bottom: 0.5rem;
|
45 |
}
|
46 |
-
p.subtitle {
|
47 |
-
|
48 |
-
|
49 |
-
margin-bottom:
|
50 |
-
|
51 |
-
form { display: flex; flex-direction: column; gap: 1.5rem; }
|
52 |
-
.form-group {
|
53 |
border: 1px solid var(--border-color);
|
54 |
-
padding: 1.25rem;
|
55 |
border-radius: 12px;
|
56 |
}
|
57 |
-
.form-
|
|
|
58 |
font-weight: 600;
|
59 |
color: var(--primary-color);
|
60 |
padding: 0 0.5rem;
|
61 |
-
margin-left:
|
62 |
}
|
63 |
-
|
|
|
|
|
64 |
border: 2px dashed var(--border-color);
|
65 |
padding: 2rem;
|
66 |
border-radius: 8px;
|
67 |
text-align: center;
|
68 |
cursor: pointer;
|
69 |
-
transition: background-color 0.2s;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
}
|
71 |
-
input[type="file"]:hover { background-color: #f1f3f5; }
|
72 |
.radio-group label, .checkbox-group label {
|
73 |
display: inline-flex;
|
74 |
align-items: center;
|
75 |
-
margin-right: 1.5rem;
|
76 |
cursor: pointer;
|
77 |
}
|
78 |
-
|
79 |
.submit-btn {
|
|
|
80 |
background-image: linear-gradient(45deg, #0d6efd, #0dcaf0);
|
81 |
-
color: white; border: none; padding: 1rem
|
82 |
-
font-size: 1.
|
|
|
83 |
box-shadow: 0 4px 15px rgba(13, 110, 253, 0.3);
|
84 |
}
|
85 |
-
.submit-btn:hover {
|
86 |
-
|
|
|
|
|
|
|
|
|
87 |
h2 { color: var(--heading-color); border-bottom: 3px solid var(--primary-color); padding-bottom: 0.5rem; display: inline-block; margin-bottom: 1.5rem; }
|
88 |
video { width: 100%; border-radius: 12px; box-shadow: var(--shadow); }
|
89 |
.script-box {
|
90 |
-
background-color: #212529; color: #f8f9fa; border: 1px solid #343a40; padding: 1.5rem;
|
91 |
-
white-space: pre-wrap; word-wrap: break-word; font-family: "SF Mono", "Fira Code", monospace;
|
92 |
-
line-height: 1.7; margin-top: 1rem; max-height:
|
93 |
}
|
|
|
94 |
.flash-message {
|
95 |
padding: 1rem; margin-bottom: 1.5rem; border-radius: 8px;
|
96 |
background-color: #f8d7da; color: #721c24; border: 1px solid #f5c6cb;
|
97 |
text-align: center; font-weight: 600;
|
98 |
}
|
|
|
99 |
#loader { text-align: center; display: none; padding: 2rem; }
|
100 |
#loader p { font-size: 1.2rem; font-weight: 600; color: var(--primary-color); }
|
101 |
</style>
|
102 |
</head>
|
103 |
<body>
|
104 |
<div class="container">
|
105 |
-
<
|
106 |
-
|
|
|
|
|
107 |
|
108 |
{% with messages = get_flashed_messages() %}
|
109 |
{% if messages %}
|
@@ -114,12 +143,16 @@
|
|
114 |
{% endwith %}
|
115 |
|
116 |
<form id="dubbing-form" action="/process" method="POST" enctype="multipart/form-data">
|
117 |
-
<fieldset class="form-
|
118 |
<legend>1. Upload Video</legend>
|
|
|
|
|
|
|
|
|
119 |
<input type="file" id="video" name="video" accept="video/mp4,video/mov,video/webm" required>
|
120 |
</fieldset>
|
121 |
|
122 |
-
<fieldset class="form-
|
123 |
<legend>2. Configure Voice</legend>
|
124 |
<div class="radio-group">
|
125 |
<label><input type="radio" name="voice_choice" value="Male (Charon)" checked> Male Voice</label>
|
@@ -148,15 +181,30 @@
|
|
148 |
<div class="script-box">{{ script }}</div>
|
149 |
</div>
|
150 |
{% endif %}
|
151 |
-
|
152 |
</div>
|
153 |
|
154 |
<script>
|
155 |
-
document.getElementById('dubbing-form')
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
160 |
}
|
161 |
});
|
162 |
</script>
|
|
|
5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
<title>AI Video Narrator</title>
|
7 |
<style>
|
8 |
+
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap');
|
9 |
|
10 |
:root {
|
11 |
--primary-color: #0d6efd;
|
12 |
+
--secondary-color: #6c757d;
|
13 |
--background-color: #f8f9fa;
|
14 |
--card-background: #ffffff;
|
|
|
15 |
--heading-color: #212529;
|
16 |
--border-color: #dee2e6;
|
17 |
+
--shadow: 0 8px 30px rgba(0,0,0,0.1);
|
18 |
+
}
|
19 |
+
|
20 |
+
*, *::before, *::after {
|
21 |
+
box-sizing: border-box;
|
22 |
}
|
23 |
|
24 |
body {
|
25 |
+
font-family: 'Inter', sans-serif;
|
26 |
margin: 0;
|
27 |
background-color: var(--background-color);
|
28 |
display: flex;
|
29 |
justify-content: center;
|
30 |
+
align-items: flex-start;
|
31 |
padding: 2rem;
|
32 |
min-height: 100vh;
|
33 |
}
|
|
|
35 |
background-color: var(--card-background);
|
36 |
padding: 2.5rem 3rem;
|
37 |
border-radius: 20px;
|
38 |
+
border: 1px solid var(--border-color);
|
39 |
box-shadow: var(--shadow);
|
40 |
width: 100%;
|
41 |
+
max-width: 700px;
|
42 |
transition: all 0.3s ease;
|
43 |
}
|
44 |
+
header { text-align: center; margin-bottom: 2.5rem; }
|
45 |
h1 {
|
|
|
46 |
color: var(--heading-color);
|
47 |
font-weight: 700;
|
48 |
margin-bottom: 0.5rem;
|
49 |
}
|
50 |
+
p.subtitle { color: var(--secondary-color); }
|
51 |
+
|
52 |
+
.form-step {
|
53 |
+
margin-bottom: 1.5rem;
|
54 |
+
padding: 1.5rem;
|
|
|
|
|
55 |
border: 1px solid var(--border-color);
|
|
|
56 |
border-radius: 12px;
|
57 |
}
|
58 |
+
.form-step legend {
|
59 |
+
font-size: 1.1rem;
|
60 |
font-weight: 600;
|
61 |
color: var(--primary-color);
|
62 |
padding: 0 0.5rem;
|
63 |
+
margin-left: 0.5rem;
|
64 |
}
|
65 |
+
|
66 |
+
.file-upload-label {
|
67 |
+
display: block;
|
68 |
border: 2px dashed var(--border-color);
|
69 |
padding: 2rem;
|
70 |
border-radius: 8px;
|
71 |
text-align: center;
|
72 |
cursor: pointer;
|
73 |
+
transition: background-color 0.2s, border-color 0.2s;
|
74 |
+
}
|
75 |
+
.file-upload-label:hover {
|
76 |
+
background-color: #f1f3f5;
|
77 |
+
border-color: var(--primary-color);
|
78 |
+
}
|
79 |
+
input[type="file"] { display: none; }
|
80 |
+
#file-name {
|
81 |
+
margin-top: 1rem;
|
82 |
+
font-style: italic;
|
83 |
+
color: var(--secondary-color);
|
84 |
+
}
|
85 |
+
|
86 |
+
.radio-group, .checkbox-group {
|
87 |
+
display: flex;
|
88 |
+
gap: 1.5rem;
|
89 |
+
justify-content: center;
|
90 |
+
padding-top: 0.5rem;
|
91 |
}
|
|
|
92 |
.radio-group label, .checkbox-group label {
|
93 |
display: inline-flex;
|
94 |
align-items: center;
|
|
|
95 |
cursor: pointer;
|
96 |
}
|
97 |
+
|
98 |
.submit-btn {
|
99 |
+
width: 100%;
|
100 |
background-image: linear-gradient(45deg, #0d6efd, #0dcaf0);
|
101 |
+
color: white; border: none; padding: 1rem; border-radius: 12px;
|
102 |
+
font-size: 1.2rem; font-weight: 600; cursor: pointer;
|
103 |
+
transition: all 0.3s ease;
|
104 |
box-shadow: 0 4px 15px rgba(13, 110, 253, 0.3);
|
105 |
}
|
106 |
+
.submit-btn:hover {
|
107 |
+
transform: translateY(-3px);
|
108 |
+
box-shadow: 0 7px 20px rgba(13, 110, 253, 0.4);
|
109 |
+
}
|
110 |
+
|
111 |
+
.result-section { margin-top: 2.5rem; border-top: 2px solid var(--border-color); padding-top: 2.5rem; }
|
112 |
h2 { color: var(--heading-color); border-bottom: 3px solid var(--primary-color); padding-bottom: 0.5rem; display: inline-block; margin-bottom: 1.5rem; }
|
113 |
video { width: 100%; border-radius: 12px; box-shadow: var(--shadow); }
|
114 |
.script-box {
|
115 |
+
background-color: #212529; color: #f8f9fa; border: 1px solid #343a40; padding: 1.5rem;
|
116 |
+
border-radius: 8px; white-space: pre-wrap; word-wrap: break-word; font-family: "SF Mono", "Fira Code", monospace;
|
117 |
+
line-height: 1.7; margin-top: 1rem; max-height: 250px; overflow-y: auto;
|
118 |
}
|
119 |
+
|
120 |
.flash-message {
|
121 |
padding: 1rem; margin-bottom: 1.5rem; border-radius: 8px;
|
122 |
background-color: #f8d7da; color: #721c24; border: 1px solid #f5c6cb;
|
123 |
text-align: center; font-weight: 600;
|
124 |
}
|
125 |
+
|
126 |
#loader { text-align: center; display: none; padding: 2rem; }
|
127 |
#loader p { font-size: 1.2rem; font-weight: 600; color: var(--primary-color); }
|
128 |
</style>
|
129 |
</head>
|
130 |
<body>
|
131 |
<div class="container">
|
132 |
+
<header>
|
133 |
+
<h1>AI Video Narrator</h1>
|
134 |
+
<p class="subtitle">Upload a video, choose a voice, and let AI create a new, expressive narration.</p>
|
135 |
+
</header>
|
136 |
|
137 |
{% with messages = get_flashed_messages() %}
|
138 |
{% if messages %}
|
|
|
143 |
{% endwith %}
|
144 |
|
145 |
<form id="dubbing-form" action="/process" method="POST" enctype="multipart/form-data">
|
146 |
+
<fieldset class="form-step">
|
147 |
<legend>1. Upload Video</legend>
|
148 |
+
<label for="video" class="file-upload-label">
|
149 |
+
<span>Click to select a video file</span>
|
150 |
+
<div id="file-name">No file chosen</div>
|
151 |
+
</label>
|
152 |
<input type="file" id="video" name="video" accept="video/mp4,video/mov,video/webm" required>
|
153 |
</fieldset>
|
154 |
|
155 |
+
<fieldset class="form-step">
|
156 |
<legend>2. Configure Voice</legend>
|
157 |
<div class="radio-group">
|
158 |
<label><input type="radio" name="voice_choice" value="Male (Charon)" checked> Male Voice</label>
|
|
|
181 |
<div class="script-box">{{ script }}</div>
|
182 |
</div>
|
183 |
{% endif %}
|
|
|
184 |
</div>
|
185 |
|
186 |
<script>
|
187 |
+
const form = document.getElementById('dubbing-form');
|
188 |
+
const loader = document.getElementById('loader');
|
189 |
+
const videoInput = document.getElementById('video');
|
190 |
+
const fileNameDisplay = document.getElementById('file-name');
|
191 |
+
|
192 |
+
videoInput.addEventListener('change', function() {
|
193 |
+
if (this.files && this.files.length > 0) {
|
194 |
+
fileNameDisplay.textContent = this.files[0].name;
|
195 |
+
} else {
|
196 |
+
fileNameDisplay.textContent = 'No file chosen';
|
197 |
+
}
|
198 |
+
});
|
199 |
+
|
200 |
+
form.addEventListener('submit', function(event) {
|
201 |
+
if (!videoInput.value) {
|
202 |
+
// Prevent form submission if no file is selected
|
203 |
+
event.preventDefault();
|
204 |
+
alert('Please select a video file before submitting.');
|
205 |
+
} else {
|
206 |
+
form.style.display = 'none';
|
207 |
+
loader.style.display = 'block';
|
208 |
}
|
209 |
});
|
210 |
</script>
|