<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- Added for responsiveness -->
<title>Video Transcriber</title>
<link href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,400;0,700;1,400&family=Roboto+Mono&display=swap" rel="stylesheet"> <!-- Modern fonts -->
<style>
body {
font-family: 'Roboto', sans-serif;
background: linear-gradient(135deg, #f4f4f4, #e0e0e0); /* Subtle gradient for a modern feel */
padding: 1rem;
margin: 0;
color: #333;
}
h1 {
color: #2c3e50; /* Modern blue-gray color */
font-size: 2.5rem;
text-align: center;
margin-bottom: 1.5rem;
}
.container {
background: white;
padding: 2rem;
border-radius: 12px; /* More rounded corners */
max-width: 800px; /* Increased for better readability */
margin: 2rem auto; /* Centered with more space */
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1); /* Softer, modern shadow */
display: flex; /* Use flex for better alignment */
flex-direction: column;
align-items: center;
}
form {
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
}
input[type="file"] {
width: 100%;
padding: 0.75rem;
margin-bottom: 1.5rem;
border: 1px solid #ddd;
border-radius: 8px;
background-color: #f9f9f9;
font-family: 'Roboto', sans-serif;
font-size: 1rem;
transition: border-color 0.3s; /* Smooth transition for focus */
}
input[type="file"]:focus {
border-color: #3498db; /* Blue accent on focus */
outline: none;
}
button {
padding: 0.75rem 1.5rem;
font-size: 1rem;
font-weight: 700;
background: linear-gradient(135deg, #3498db, #2980b9); /* Gradient for modern button */
color: white;
border: none;
border-radius: 8px;
cursor: pointer;
transition: background 0.3s, transform 0.2s; /* Smooth hover and click effects */
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}
button:hover {
background: linear-gradient(135deg, #2980b9, #3498db); /* Reversed gradient on hover */
transform: translateY(-2px); /* Subtle lift effect */
}
button:active {
transform: translateY(0);
}
textarea {
width: 100%;
height: 400px;
font-family: 'Roboto Mono', monospace; /* Monospaced for code-like appearance */
padding: 1rem;
border: 1px solid #ddd;
border-radius: 8px;
background-color: #f9f9f9;
font-size: 0.95rem;
resize: vertical; /* Allow users to resize vertically */
transition: border-color 0.3s;
}
textarea:focus {
border-color: #3498db;
outline: none;
}
/* Responsive adjustments */
@media (max-width: 768px) {
.container {
padding: 1.5rem;
margin: 1rem auto;
}
h1 {
font-size: 2rem;
}
button {
width: 100%; /* Full width on mobile */
padding: 0.75rem;
}
textarea {
height: 300px; /* Shorter on mobile for better scrolling */
}
}
</style>
</head>
<body>
<div class="container">
<h1>Upload Video to Get SRT</h1>
<form id="transcribeForm">
<input type="file" name="file" accept="video/*,audio/*" required />
<br>
<button type="submit">Transcribe</button>
</form>
<textarea id="textOutput" placeholder="Transcript will appear here..." readonly></textarea>
</div>
<script>
document.getElementById("transcribeForm").addEventListener("submit", async function (e) {
e.preventDefault();
const formData = new FormData(e.target);
const textOutput = document.getElementById("textOutput");
textOutput.value = "Transcribing... Please wait.";
try {
const response = await fetch("/transcribe", {
method: "POST",
body: formData,
});
const result = await response.json();
if (response.ok) {
textOutput.value = result.translated_text;
} else {
textOutput.value = result.error || "An error occurred.";
}
} catch (err) {
textOutput.value = "An error occurred: " + err.message;
}
});
</script>
</body>
</html>
This should give your site a fresh, professional look while maintaining its core functionality. If you'd like further customizations (e.g., adding icons, more animations, or specific color changes), let me know!
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Video Transcriber</title>
<link href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,400;0,700;1,400&family=Roboto+Mono&display=swap" rel="stylesheet">
<style>
:root {
--primary-color: #3498db;
--secondary-color: #2980b9;
--background-color: #f4f4f4;
--text-color: #333;
--container-bg: #fff;
/* Dark mode variables */
--dark-bg: #2c3e50;
--dark-text: #f4f4f4;
--dark-container-bg: #34495e;
}
[data-theme="dark"] {
--primary-color: #8e44ad;
--secondary-color: #9b59b6;
--background-color: #2c3e50;
--text-color: #f4f4f4;
--container-bg: #34495e;
}
body {
font-family: 'Roboto', sans-serif;
background: linear-gradient(135deg, var(--background-color), #e0e0e0);
color: var(--text-color);
margin: 0;
padding: 1rem;
transition: background 0.3s, color 0.3s;
}
h1 {
color: var(--primary-color);
font-size: 2.5rem;
text-align: center;
margin-bottom: 1.5rem;
animation: fadeIn 0.5s ease-in;
}
.container {
background: var(--container-bg);
padding: 2rem;
border-radius: 12px;
max-width: 800px;
margin: 2rem auto;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
display: grid; /* Use CSS Grid for groundbreaking layout */
grid-template-areas:
"header"
"form"
"output";
gap: 1.5rem;
animation: slideUp 0.6s ease-out;
}
.header { grid-area: header; }
.form-area { grid-area: form; }
.output-area { grid-area: output; }
.drop-zone {
grid-area: form;
border: 2px dashed var(--primary-color);
border-radius: 8px;
padding: 2rem;
text-align: center;
background: rgba(52, 152, 219, 0.1);
cursor: pointer;
transition: background 0.3s;
animation: pulse 2s infinite ease-in-out; /* Subtle animation for interactivity */
}
.drop-zone.dragover {
background: rgba(52, 152, 219, 0.2);
border-color: var(--secondary-color);
}
.progress-bar {
width: 100%;
height: 8px;
background: #ddd;
border-radius: 4px;
overflow: hidden;
margin-top: 1rem;
display: none; /* Hidden by default */
}
.progress-bar-fill {
height: 100%;
background: var(--primary-color);
width: 0;
transition: width 0.3s;
}
textarea {
width: 100%;
height: 400px;
font-family: 'Roboto Mono', monospace;
padding: 1rem;
border: 1px solid #ddd;
border-radius: 8px;
background: rgba(255, 255, 255, 0.9);
font-size: 0.95rem;
resize: vertical;
transition: border-color 0.3s;
animation: fadeIn 0.5s ease-in;
}
textarea:focus {
border-color: var(--primary-color);
outline: none;
}
button {
padding: 0.75rem 1.5rem;
font-size: 1rem;
font-weight: 700;
background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
color: var(--container-bg);
border: none;
border-radius: 8px;
cursor: pointer;
transition: transform 0.2s, background 0.3s;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
animation: bounceIn 0.5s ease-out;
}
button:hover {
transform: translateY(-2px);
background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
}
.theme-toggle {
position: absolute;
top: 1rem;
right: 1rem;
background: var(--primary-color);
color: white;
border: none;
padding: 0.5rem 1rem;
border-radius: 8px;
cursor: pointer;
transition: background 0.3s;
}
.theme-toggle:hover {
background: var(--secondary-color);
}
/* Modal for messages */
.modal {
display: none;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background: var(--container-bg);
padding: 1.5rem;
border-radius: 8px;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
z-index: 1000;
animation: zoomIn 0.3s ease-out;
}
.modal.active {
display: block;
}
/* Animations */
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
@keyframes slideUp {
from { transform: translateY(20px); opacity: 0; }
to { transform: translateY(0); opacity: 1; }
}
@keyframes bounceIn {
from { transform: scale(0.8); opacity: 0; }
to { transform: scale(1); opacity: 1; }
}
@keyframes pulse {
0% { transform: scale(1); }
50% { transform: scale(1.05); }
100% { transform: scale(1); }
}
@keyframes zoomIn {
from { transform: scale(0.5); opacity: 0; }
to { transform: scale(1); opacity: 1; }
}
/* Responsive */
@media (max-width: 768px) {
.container {
padding: 1.5rem;
grid-template-areas:
"header"
"form"
"output";
}
h1 { font-size: 2rem; }
textarea { height: 300px; }
}
</style>
</head>
<body>
<button class="theme-toggle" onclick="toggleTheme()">Toggle Dark Mode</button>
<div class="container">
<div class="header"><h1>Upload Video to Get SRT</h1></div>
<div class="form-area">
<div id="dropZone" class="drop-zone">Drag & Drop Video/Audio Here or Click to Select</div>
<div class="progress-bar"><div id="progressFill" class="progress-bar-fill"></div></div>
</div>
<div class="output-area">
<textarea id="textOutput" placeholder="Transcript will appear here..." readonly></textarea>
</div>
</div>
<div id="modal" class="modal">
<p id="modalMessage"></p>
<button onclick="closeModal()">Close</button>
</div>
<script>
// Theme toggle
function toggleTheme() {
const currentTheme = document.documentElement.getAttribute('data-theme');
document.documentElement.setAttribute('data-theme', currentTheme === 'dark' ? 'light' : 'dark');
}
// Drag and Drop
const dropZone = document.getElementById('dropZone');
const fileInput = document.createElement('input');
fileInput.type = 'file';
fileInput.name = 'file';
fileInput.accept = 'video/*,audio/*';
fileInput.style.display = 'none'; // Hide the actual input
dropZone.appendChild(fileInput);
dropZone.addEventListener('click', () => fileInput.click());
dropZone.addEventListener('dragover', (e) => {
e.preventDefault();
dropZone.classList.add('dragover');
});
dropZone.addEventListener('dragleave', () => dropZone.classList.remove('dragover'));
dropZone.addEventListener('drop', (e) => {
e.preventDefault();
dropZone.classList.remove('dragover');
const files = e.dataTransfer.files;
if (files.length > 0) handleFile(files[0]);
});
fileInput.addEventListener('change', (e) => {
if (e.target.files.length > 0) handleFile(e.target.files[0]);
});
function handleFile(file) {
const form = document.getElementById('transcribeForm'); // Assuming form exists, but we're handling dynamically
const formData = new FormData();
formData.append('file', file);
startTranscription(formData);
}
async function startTranscription(formData) {
const textOutput = document.getElementById('textOutput');
const progressFill = document.getElementById('progressFill');
const progressBar = document.querySelector('.progress-bar');
textOutput.value = 'Transcribing... Please wait.';
progressBar.style.display = 'block'; // Show progress bar
// Simulate progress (in a real app, use Fetch with progress events)
let progress = 0;
const interval = setInterval(() => {
if (progress < 100) {
progress += 10;
progressFill.style.width = progress + '%';
}
}, 500);
try {
const response = await fetch('/transcribe', {
method: 'POST',
body: formData,
});
clearInterval(interval); // Stop simulation
progressFill.style.width = '100%'; // Complete progress
const result = await response.json();
if (response.ok) {
textOutput.value = result.translated_text;
showModal('Transcription complete!');
} else {
showModal(result.error || 'An error occurred.');
}
} catch (err) {
clearInterval(interval);
showModal('An error occurred: ' + err.message);
} finally {
progressBar.style.display = 'none'; // Hide after
progressFill.style.width = '0';
}
}
function showModal(message) {
const modal = document.getElementById('modal');
const modalMessage = document.getElementById('modalMessage');
modalMessage.textContent = message;
modal.classList.add('active');
}
function closeModal() {
const modal = document.getElementById('modal');
modal.classList.remove('active');
}
</script>
</body>
</html>
This should feel like a significant leap forward. If it's still not quite what you envisioned (e.g., integrating WebSockets for real-time updates or adding AI-driven features), let me know more details, and I'll iterate further! 🚀