AutoSubGen / templates /index.html
Athspi's picture
Create templates/index.html
12ef355 verified
raw
history blame
8.42 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AutoSubGen Pro - AI Video Subtitle Generator</title>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
line-height: 1.6;
background-color: #f7f7f7;
color: #333;
margin: 0;
padding: 20px;
}
.container {
max-width: 800px;
margin: 0 auto;
background-color: #fff;
padding: 30px;
border-radius: 10px;
box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}
h1, h2 {
text-align: center;
color: #444;
}
h1 {
font-size: 2.5em;
margin-bottom: 5px;
}
h2 {
font-size: 1.2em;
font-weight: 300;
margin-top: 0;
margin-bottom: 30px;
}
form {
display: flex;
flex-direction: column;
gap: 20px;
}
.form-group {
border: 1px solid #ddd;
padding: 20px;
border-radius: 8px;
}
label {
display: block;
margin-bottom: 8px;
font-weight: 600;
color: #555;
}
input[type="file"], select {
width: 100%;
padding: 10px;
border: 1px solid #ccc;
border-radius: 5px;
box-sizing: border-box;
}
.checkbox-group {
display: flex;
align-items: center;
gap: 10px;
}
input[type="checkbox"] {
width: 18px;
height: 18px;
}
button {
background-color: #007bff;
color: white;
padding: 12px 20px;
border: none;
border-radius: 5px;
cursor: pointer;
font-size: 1.1em;
font-weight: 600;
transition: background-color 0.3s;
}
button:hover {
background-color: #0056b3;
}
#loader {
display: none;
text-align: center;
padding: 20px;
font-size: 1.2em;
}
#results {
margin-top: 30px;
border-top: 1px solid #eee;
padding-top: 20px;
}
.result-item {
background-color: #e9f5ff;
border: 1px solid #b3d7ff;
padding: 15px;
margin-bottom: 15px;
border-radius: 5px;
}
.result-item h3 {
margin-top: 0;
color: #0056b3;
}
.result-item a {
display: inline-block;
background-color: #28a745;
color: white;
padding: 8px 15px;
text-decoration: none;
border-radius: 5px;
transition: background-color 0.3s;
}
.result-item a:hover {
background-color: #218838;
}
.result-item video, .result-item audio {
width: 100%;
margin-top: 10px;
border-radius: 5px;
}
.error {
color: #D8000C;
background-color: #FFD2D2;
border: 1px solid #D8000C;
padding: 15px;
margin-bottom: 20px;
border-radius: 5px;
text-align: center;
}
</style>
</head>
<body>
<div class="container">
<h1>🎥 AutoSubGen Pro</h1>
<h2>AI-Powered Video Subtitle Generator</h2>
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
{% for category, message in messages %}
<div class="error">{{ message }}</div>
{% endfor %}
{% endif %}
{% endwith %}
<form id="upload-form" action="{{ url_for('process') }}" method="post" enctype="multipart/form-data">
<div class="form-group">
<label for="video">1. Upload Your Video File</label>
<input type="file" id="video" name="video" accept="video/*" required>
</div>
<div class="form-group">
<label for="language_dropdown">2. Select Video Language (or let AI detect it)</label>
<select id="language_dropdown" name="source_language">
{% for lang in supported_languages %}
<option value="{{ lang }}">{{ lang }}</option>
{% endfor %}
</select>
</div>
<div class="form-group">
<label for="translate_to_dropdown">3. (Optional) Translate Subtitles To:</label>
<select id="translate_to_dropdown" name="translate_to">
<option value="None">None</option>
{% for lang in supported_languages[1:] %}
<option value="{{ lang }}">{{ lang }}</option>
{% endfor %}
</select>
</div>
<div class="form-group">
<label>4. (Optional) Additional Outputs</label>
<div class="checkbox-group">
<input type="checkbox" id="tts_checkbox" name="add_tts">
<label for="tts_checkbox">Generate Text-to-Speech Audio of Subtitles</label>
</div>
<div class="checkbox-group">
<input type="checkbox" id="subtitles_checkbox" name="add_subtitles">
<label for="subtitles_checkbox">Add Subtitles to Video (burn-in)</label>
</div>
</div>
<button type="submit">Process Video</button>
</form>
<div id="loader">
<p>Processing your video... This may take a few minutes.</p>
<img src="https://i.gifer.com/ZKZg.gif" alt="Loading..." width="50">
</div>
{% if results %}
<div id="results">
<h2>Processing Complete!</h2>
{% if results.detected_language %}
<div class="result-item">
<h3>Detected Language</h3>
<p>{{ results.detected_language }}</p>
</div>
{% endif %}
{% if results.original_srt_file %}
<div class="result-item">
<h3>Original Subtitles (SRT)</h3>
<a href="{{ url_for('download_file', session_id=session_id, filename=results.original_srt_file) }}" download>Download Original SRT</a>
</div>
{% endif %}
{% if results.translated_srt_file %}
<div class="result-item">
<h3>Translated Subtitles (SRT)</h3>
<a href="{{ url_for('download_file', session_id=session_id, filename=results.translated_srt_file) }}" download>Download Translated SRT</a>
</div>
{% endif %}
{% if results.tts_audio_file %}
<div class="result-item">
<h3>Text-to-Speech Audio</h3>
<audio controls src="{{ url_for('download_file', session_id=session_id, filename=results.tts_audio_file) }}"></audio>
<br>
<a href="{{ url_for('download_file', session_id=session_id, filename=results.tts_audio_file) }}" download>Download TTS Audio (MP3)</a>
</div>
{% endif %}
{% if results.output_video_file %}
<div class="result-item">
<h3>Video with Subtitles</h3>
<video controls src="{{ url_for('download_file', session_id=session_id, filename=results.output_video_file) }}"></video>
<br>
<a href="{{ url_for('download_file', session_id=session_id, filename=results.output_video_file) }}" download>Download Final Video (MP4)</a>
</div>
{% endif %}
</div>
{% endif %}
</div>
<script>
document.getElementById('upload-form').addEventListener('submit', function() {
document.getElementById('loader').style.display = 'block';
});
</script>
</body>
</html>