Translate / templates /index.html
Athspi's picture
Update templates/index.html
dc50b0b verified
raw
history blame
7.84 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AI Video Narrator</title>
<style>
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap');
:root {
--primary-color: #0d6efd;
--secondary-color: #6c757d;
--background-color: #f8f9fa;
--card-background: #ffffff;
--heading-color: #212529;
--border-color: #dee2e6;
--shadow: 0 8px 30px rgba(0,0,0,0.1);
}
*, *::before, *::after {
box-sizing: border-box;
}
body {
font-family: 'Inter', sans-serif;
margin: 0;
background-color: var(--background-color);
display: flex;
justify-content: center;
align-items: flex-start;
padding: 2rem;
min-height: 100vh;
}
.container {
background-color: var(--card-background);
padding: 2.5rem 3rem;
border-radius: 20px;
border: 1px solid var(--border-color);
box-shadow: var(--shadow);
width: 100%;
max-width: 700px;
transition: all 0.3s ease;
}
header { text-align: center; margin-bottom: 2.5rem; }
h1 {
color: var(--heading-color);
font-weight: 700;
margin-bottom: 0.5rem;
}
p.subtitle { color: var(--secondary-color); }
.form-step {
margin-bottom: 1.5rem;
padding: 1.5rem;
border: 1px solid var(--border-color);
border-radius: 12px;
}
.form-step legend {
font-size: 1.1rem;
font-weight: 600;
color: var(--primary-color);
padding: 0 0.5rem;
margin-left: 0.5rem;
}
.file-upload-label {
display: block;
border: 2px dashed var(--border-color);
padding: 2rem;
border-radius: 8px;
text-align: center;
cursor: pointer;
transition: background-color 0.2s, border-color 0.2s;
}
.file-upload-label:hover {
background-color: #f1f3f5;
border-color: var(--primary-color);
}
input[type="file"] { display: none; }
#file-name {
margin-top: 1rem;
font-style: italic;
color: var(--secondary-color);
}
.radio-group, .checkbox-group {
display: flex;
gap: 1.5rem;
justify-content: center;
padding-top: 0.5rem;
}
.radio-group label, .checkbox-group label {
display: inline-flex;
align-items: center;
cursor: pointer;
}
.submit-btn {
width: 100%;
background-image: linear-gradient(45deg, #0d6efd, #0dcaf0);
color: white; border: none; padding: 1rem; border-radius: 12px;
font-size: 1.2rem; font-weight: 600; cursor: pointer;
transition: all 0.3s ease;
box-shadow: 0 4px 15px rgba(13, 110, 253, 0.3);
}
.submit-btn:hover {
transform: translateY(-3px);
box-shadow: 0 7px 20px rgba(13, 110, 253, 0.4);
}
.result-section { margin-top: 2.5rem; border-top: 2px solid var(--border-color); padding-top: 2.5rem; }
h2 { color: var(--heading-color); border-bottom: 3px solid var(--primary-color); padding-bottom: 0.5rem; display: inline-block; margin-bottom: 1.5rem; }
video { width: 100%; border-radius: 12px; box-shadow: var(--shadow); }
.script-box {
background-color: #212529; color: #f8f9fa; border: 1px solid #343a40; padding: 1.5rem;
border-radius: 8px; white-space: pre-wrap; word-wrap: break-word; font-family: "SF Mono", "Fira Code", monospace;
line-height: 1.7; margin-top: 1rem; max-height: 250px; overflow-y: auto;
}
.flash-message {
padding: 1rem; margin-bottom: 1.5rem; border-radius: 8px;
background-color: #f8d7da; color: #721c24; border: 1px solid #f5c6cb;
text-align: center; font-weight: 600;
}
#loader { text-align: center; display: none; padding: 2rem; }
#loader p { font-size: 1.2rem; font-weight: 600; color: var(--primary-color); }
</style>
</head>
<body>
<div class="container">
<header>
<h1>AI Video Narrator</h1>
<p class="subtitle">Upload a video, choose a voice, and let AI create a new, expressive narration.</p>
</header>
{% with messages = get_flashed_messages() %}
{% if messages %}
<div class="flash-message">
{{ messages[0] }}
</div>
{% endif %}
{% endwith %}
<form id="dubbing-form" action="/process" method="POST" enctype="multipart/form-data">
<fieldset class="form-step">
<legend>1. Upload Video</legend>
<label for="video" class="file-upload-label">
<span>Click to select a video file</span>
<div id="file-name">No file chosen</div>
</label>
<input type="file" id="video" name="video" accept="video/mp4,video/mov,video/webm" required>
</fieldset>
<fieldset class="form-step">
<legend>2. Configure Voice</legend>
<div class="radio-group">
<label><input type="radio" name="voice_choice" value="Male (Charon)" checked> Male Voice</label>
<label><input type="radio" name="voice_choice" value="Female (Zephyr)"> Female Voice</label>
</div>
<div class="checkbox-group" style="margin-top: 1rem;">
<label><input type="checkbox" name="cheerful"> Use a more cheerful tone</label>
</div>
</fieldset>
<button type="submit" class="submit-btn">Generate Dubbed Video</button>
</form>
<div id="loader">
<p>Processing your video... This may take a few minutes.</p>
</div>
{% if result_video %}
<div class="result-section">
<h2>Your Dubbed Video</h2>
<video controls>
<source src="{{ result_video }}" type="video/mp4">
Your browser does not support the video tag.
</video>
<h2>Generated Script</h2>
<div class="script-box">{{ script }}</div>
</div>
{% endif %}
</div>
<script>
const form = document.getElementById('dubbing-form');
const loader = document.getElementById('loader');
const videoInput = document.getElementById('video');
const fileNameDisplay = document.getElementById('file-name');
videoInput.addEventListener('change', function() {
if (this.files && this.files.length > 0) {
fileNameDisplay.textContent = this.files[0].name;
} else {
fileNameDisplay.textContent = 'No file chosen';
}
});
form.addEventListener('submit', function(event) {
if (!videoInput.value) {
// Prevent form submission if no file is selected
event.preventDefault();
alert('Please select a video file before submitting.');
} else {
form.style.display = 'none';
loader.style.display = 'block';
}
});
</script>
</body>
</html>