Download index.html from Lawancy/evai: direct link, hf CLI and curl.
- Browser
- Download file 37.7 kB
-
https://huggingface.co/spaces/Lawancy/evai/resolve/main/index.html
- Command line
-
hf download hf://spaces/Lawancy/evai/index.html
-
curl -L -o index.html https://huggingface.co/spaces/Lawancy/evai/resolve/main/index.html
37.7 kB
| <html lang="en" class="dark"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>EverythingAI | EVAI Text-to-Speech</title> | |
| <script src="https://cdn.tailwindcss.com"></script> | |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> | |
| <style> | |
| @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap'); | |
| body { | |
| font-family: 'Poppins', sans-serif; | |
| transition: background-color 0.3s, color 0.3s; | |
| } | |
| .highlight-word { | |
| background-color: rgba(99, 102, 241, 0.3); | |
| transition: background-color 0.2s; | |
| } | |
| .waveform { | |
| height: 60px; | |
| background: linear-gradient(90deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%); | |
| mask-image: url('data:image/svg+xml;utf8,<svg viewBox="0 0 100 20" xmlns="http://www.w3.org/2000/svg"><path d="M0 10 Q 5 5 10 10 T 20 10 T 30 10 T 40 10 T 50 10 T 60 10 T 70 10 T 80 10 T 90 10 T 100 10" stroke="none" fill="black"/></svg>'); | |
| mask-size: 100% 100%; | |
| animation: wave 2s linear infinite; | |
| } | |
| @keyframes wave { | |
| 0% { mask-position: 0% 0%; } | |
| 100% { mask-position: 100% 0%; } | |
| } | |
| .file-upload:hover .upload-icon { | |
| transform: translateY(-5px); | |
| } | |
| .voice-card:hover { | |
| transform: translateY(-5px); | |
| box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1); | |
| } | |
| .progress-bar { | |
| transition: width 0.5s ease; | |
| } | |
| /* Custom scrollbar */ | |
| ::-webkit-scrollbar { | |
| width: 8px; | |
| height: 8px; | |
| } | |
| ::-webkit-scrollbar-track { | |
| background: #f1f1f1; | |
| } | |
| ::-webkit-scrollbar-thumb { | |
| background: #888; | |
| border-radius: 4px; | |
| } | |
| ::-webkit-scrollbar-thumb:hover { | |
| background: #555; | |
| } | |
| .dark ::-webkit-scrollbar-track { | |
| background: #374151; | |
| } | |
| .dark ::-webkit-scrollbar-thumb { | |
| background: #6b7280; | |
| } | |
| .dark ::-webkit-scrollbar-thumb:hover { | |
| background: #9ca3af; | |
| } | |
| </style> | |
| </head> | |
| <body class="bg-gray-50 dark:bg-gray-900 text-gray-900 dark:text-gray-100 min-h-screen"> | |
| <div class="container mx-auto px-4 py-8 max-w-7xl"> | |
| <!-- Header --> | |
| <header class="flex justify-between items-center mb-8"> | |
| <div class="flex items-center space-x-2"> | |
| <div class="w-10 h-10 rounded-full bg-gradient-to-r from-indigo-500 to-purple-600 flex items-center justify-center text-white font-bold text-xl">E</div> | |
| <h1 class="text-2xl font-bold bg-gradient-to-r from-indigo-500 to-purple-600 bg-clip-text text-transparent">EverythingAI <span class="text-xs bg-gray-200 dark:bg-gray-700 px-2 py-1 rounded-full ml-2 text-gray-700 dark:text-gray-300">EVAI</span></h1> | |
| </div> | |
| <div class="flex items-center space-x-4"> | |
| <button id="darkModeToggle" class="p-2 rounded-full hover:bg-gray-200 dark:hover:bg-gray-700 transition"> | |
| <i class="fas fa-moon dark:hidden"></i> | |
| <i class="fas fa-sun hidden dark:block"></i> | |
| </button> | |
| <button class="px-4 py-2 rounded-full bg-gradient-to-r from-indigo-500 to-purple-600 text-white hover:from-indigo-600 hover:to-purple-700 transition"> | |
| Sign In | |
| </button> | |
| </div> | |
| </header> | |
| <!-- Main Content --> | |
| <main> | |
| <div class="grid grid-cols-1 lg:grid-cols-3 gap-8"> | |
| <!-- Left Panel - Input & Controls --> | |
| <div class="lg:col-span-2 space-y-6"> | |
| <div class="bg-white dark:bg-gray-800 rounded-xl shadow-lg p-6"> | |
| <h2 class="text-xl font-semibold mb-4">Text Input</h2> | |
| <div class="flex space-x-2 mb-4"> | |
| <button id="pasteBtn" class="px-3 py-1.5 text-sm rounded-lg bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 transition"> | |
| <i class="fas fa-paste mr-1"></i> Paste | |
| </button> | |
| <div class="file-upload relative flex-1"> | |
| <input type="file" id="fileInput" class="absolute inset-0 w-full h-full opacity-0 cursor-pointer" accept=".txt,.pdf,.docx"> | |
| <label for="fileInput" class="block px-3 py-1.5 text-sm rounded-lg bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 transition cursor-pointer flex items-center justify-between"> | |
| <span><i class="fas fa-upload mr-1 upload-icon transition"></i> Upload File</span> | |
| <span class="text-xs text-gray-500 dark:text-gray-400">.txt, .pdf, .docx</span> | |
| </label> | |
| </div> | |
| <button id="clearBtn" class="px-3 py-1.5 text-sm rounded-lg bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 transition"> | |
| <i class="fas fa-trash-alt mr-1"></i> Clear | |
| </button> | |
| </div> | |
| <div class="relative"> | |
| <textarea id="textInput" rows="10" class="w-full px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 transition" placeholder="Enter or paste your text here..."></textarea> | |
| <div class="absolute bottom-3 right-3 flex items-center space-x-2"> | |
| <span id="charCount" class="text-xs text-gray-500 dark:text-gray-400">0 characters</span> | |
| <button id="sampleBtn" class="text-xs px-2 py-1 rounded bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 transition"> | |
| Sample Text | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Voice Selection --> | |
| <div class="bg-white dark:bg-gray-800 rounded-xl shadow-lg p-6"> | |
| <h2 class="text-xl font-semibold mb-4">Voice Settings</h2> | |
| <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> | |
| <div> | |
| <label for="languageSelect" class="block text-sm font-medium mb-1">Language</label> | |
| <select id="languageSelect" class="w-full px-4 py-2 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 transition"> | |
| <option value="en">English</option> | |
| <option value="es">Spanish</option> | |
| <option value="fr">French</option> | |
| <option value="de">German</option> | |
| <option value="zh">Chinese</option> | |
| <option value="ja">Japanese</option> | |
| <option value="ru">Russian</option> | |
| <option value="ar">Arabic</option> | |
| <option value="pt">Portuguese</option> | |
| <option value="hi">Hindi</option> | |
| </select> | |
| </div> | |
| <div> | |
| <label for="voiceSelect" class="block text-sm font-medium mb-1">Voice</label> | |
| <select id="voiceSelect" class="w-full px-4 py-2 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 transition"> | |
| <option value="female1">Female 1 (Natural)</option> | |
| <option value="female2">Female 2 (Soft)</option> | |
| <option value="male1">Male 1 (Deep)</option> | |
| <option value="male2">Male 2 (Clear)</option> | |
| <option value="neutral">Neutral (Professional)</option> | |
| </select> | |
| </div> | |
| </div> | |
| <!-- Advanced Controls --> | |
| <div class="space-y-4"> | |
| <div> | |
| <label class="flex justify-between items-center"> | |
| <span class="text-sm font-medium">Speed: <span id="speedValue">1.0</span>x</span> | |
| <span class="text-xs text-gray-500 dark:text-gray-400">(0.5x - 2.0x)</span> | |
| </label> | |
| <input type="range" id="speedSlider" min="0.5" max="2.0" step="0.1" value="1.0" class="w-full h-2 bg-gray-200 dark:bg-gray-600 rounded-lg appearance-none cursor-pointer accent-indigo-500"> | |
| </div> | |
| <div> | |
| <label class="flex justify-between items-center"> | |
| <span class="text-sm font-medium">Pitch: <span id="pitchValue">0</span></span> | |
| <span class="text-xs text-gray-500 dark:text-gray-400">(-20 to +20)</span> | |
| </label> | |
| <input type="range" id="pitchSlider" min="-20" max="20" step="1" value="0" class="w-full h-2 bg-gray-200 dark:bg-gray-600 rounded-lg appearance-none cursor-pointer accent-indigo-500"> | |
| </div> | |
| <div> | |
| <label class="flex justify-between items-center"> | |
| <span class="text-sm font-medium">Volume: <span id="volumeValue">100</span>%</span> | |
| <span class="text-xs text-gray-500 dark:text-gray-400">(0% to 100%)</span> | |
| </label> | |
| <input type="range" id="volumeSlider" min="0" max="100" step="1" value="100" class="w-full h-2 bg-gray-200 dark:bg-gray-600 rounded-lg appearance-none cursor-pointer accent-indigo-500"> | |
| </div> | |
| </div> | |
| <!-- SSML Controls --> | |
| <div class="mt-6"> | |
| <div class="flex items-center justify-between mb-2"> | |
| <h3 class="text-sm font-medium">SSML Enhancements</h3> | |
| <button id="ssmlHelpBtn" class="text-xs px-2 py-1 rounded bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 transition"> | |
| <i class="fas fa-question-circle mr-1"></i> Help | |
| </button> | |
| </div> | |
| <div class="flex flex-wrap gap-2"> | |
| <button class="ssml-btn px-3 py-1 text-xs rounded-lg bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 transition" data-tag="emphasis" data-level="strong"> | |
| <i class="fas fa-bold mr-1"></i> Strong | |
| </button> | |
| <button class="ssml-btn px-3 py-1 text-xs rounded-lg bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 transition" data-tag="break" data-time="500ms"> | |
| <i class="fas fa-pause mr-1"></i> Pause | |
| </button> | |
| <button class="ssml-btn px-3 py-1 text-xs rounded-lg bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 transition" data-tag="say-as" data-interpret="cardinal"> | |
| <i class="fas fa-hashtag mr-1"></i> Number | |
| </button> | |
| <button class="ssml-btn px-3 py-1 text-xs rounded-lg bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 transition" data-tag="phoneme" data-alphabet="ipa" data-phoneme=""> | |
| <i class="fas fa-language mr-1"></i> Phoneme | |
| </button> | |
| <button class="ssml-btn px-3 py-1 text-xs rounded-lg bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 transition" data-tag="prosody" data-rate="slow"> | |
| <i class="fas fa-tachometer-alt mr-1"></i> Slow | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Right Panel - Output & Preview --> | |
| <div class="space-y-6"> | |
| <div class="bg-white dark:bg-gray-800 rounded-xl shadow-lg p-6"> | |
| <h2 class="text-xl font-semibold mb-4">Audio Output</h2> | |
| <!-- Audio Player --> | |
| <div class="mb-6"> | |
| <div class="waveform mb-4 rounded-lg overflow-hidden"></div> | |
| <div class="flex items-center justify-center space-x-4"> | |
| <button id="playBtn" class="w-12 h-12 rounded-full bg-indigo-500 text-white flex items-center justify-center hover:bg-indigo-600 transition"> | |
| <i class="fas fa-play"></i> | |
| </button> | |
| <button id="pauseBtn" class="w-10 h-10 rounded-full bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-200 flex items-center justify-center hover:bg-gray-300 dark:hover:bg-gray-600 transition"> | |
| <i class="fas fa-pause"></i> | |
| </button> | |
| <button id="stopBtn" class="w-10 h-10 rounded-full bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-200 flex items-center justify-center hover:bg-gray-300 dark:hover:bg-gray-600 transition"> | |
| <i class="fas fa-stop"></i> | |
| </button> | |
| </div> | |
| <div class="mt-4 flex items-center justify-between text-sm"> | |
| <span id="currentTime">0:00</span> | |
| <span id="durationTime">0:00</span> | |
| </div> | |
| <input type="range" id="progressBar" min="0" max="100" value="0" class="w-full h-2 bg-gray-200 dark:bg-gray-600 rounded-lg appearance-none cursor-pointer mt-2 accent-indigo-500"> | |
| </div> | |
| <!-- Output Options --> | |
| <div class="space-y-4"> | |
| <div> | |
| <label for="outputFormat" class="block text-sm font-medium mb-1">Output Format</label> | |
| <select id="outputFormat" class="w-full px-4 py-2 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 transition"> | |
| <option value="mp3">MP3 (Recommended)</option> | |
| <option value="wav">WAV (High Quality)</option> | |
| <option value="ogg">OGG (Smaller Size)</option> | |
| </select> | |
| </div> | |
| <div class="flex space-x-2"> | |
| <button id="downloadBtn" class="flex-1 px-4 py-2 rounded-lg bg-indigo-500 text-white hover:bg-indigo-600 transition flex items-center justify-center"> | |
| <i class="fas fa-download mr-2"></i> Download | |
| </button> | |
| <button id="shareBtn" class="flex-1 px-4 py-2 rounded-lg bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-200 hover:bg-gray-300 dark:hover:bg-gray-600 transition flex items-center justify-center"> | |
| <i class="fas fa-share-alt mr-2"></i> Share | |
| </button> | |
| </div> | |
| <div id="shareLinkContainer" class="hidden mt-4"> | |
| <label class="block text-sm font-medium mb-1">Shareable Link</label> | |
| <div class="flex"> | |
| <input type="text" id="shareLink" class="flex-1 px-3 py-2 rounded-l-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 transition" readonly> | |
| <button id="copyLinkBtn" class="px-3 py-2 rounded-r-lg bg-indigo-500 text-white hover:bg-indigo-600 transition"> | |
| <i class="fas fa-copy"></i> | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Preview & Highlight --> | |
| <div class="bg-white dark:bg-gray-800 rounded-xl shadow-lg p-6"> | |
| <h2 class="text-xl font-semibold mb-4">Text Preview</h2> | |
| <div id="textPreview" class="h-64 overflow-y-auto p-3 bg-gray-50 dark:bg-gray-700 rounded-lg text-sm leading-relaxed"> | |
| <p class="text-gray-500 dark:text-gray-400 italic">Your text will appear here with word-by-word highlighting as it's spoken...</p> | |
| </div> | |
| </div> | |
| <!-- API Status --> | |
| <div class="bg-white dark:bg-gray-800 rounded-xl shadow-lg p-6"> | |
| <h2 class="text-xl font-semibold mb-4">System Status</h2> | |
| <div class="space-y-3"> | |
| <div> | |
| <div class="flex justify-between text-sm mb-1"> | |
| <span>Google TTS</span> | |
| <span id="googleQuota">4,000,000 chars remaining</span> | |
| </div> | |
| <div class="w-full bg-gray-200 dark:bg-gray-600 rounded-full h-2"> | |
| <div id="googleProgress" class="bg-green-500 h-2 rounded-full progress-bar" style="width: 100%"></div> | |
| </div> | |
| </div> | |
| <div> | |
| <div class="flex justify-between text-sm mb-1"> | |
| <span>IBM Watson TTS</span> | |
| <span id="ibmQuota">10,000 chars remaining</span> | |
| </div> | |
| <div class="w-full bg-gray-200 dark:bg-gray-600 rounded-full h-2"> | |
| <div id="ibmProgress" class="bg-blue-500 h-2 rounded-full progress-bar" style="width: 100%"></div> | |
| </div> | |
| </div> | |
| <div> | |
| <div class="flex justify-between text-sm mb-1"> | |
| <span>Coqui TTS</span> | |
| <span>Self-hosted (unlimited)</span> | |
| </div> | |
| <div class="w-full bg-gray-200 dark:bg-gray-600 rounded-full h-2"> | |
| <div class="bg-purple-500 h-2 rounded-full" style="width: 100%"></div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </main> | |
| <!-- Footer --> | |
| <footer class="mt-12 pt-6 border-t border-gray-200 dark:border-gray-700"> | |
| <div class="flex flex-col md:flex-row justify-between items-center"> | |
| <div class="flex items-center space-x-2 mb-4 md:mb-0"> | |
| <div class="w-8 h-8 rounded-full bg-gradient-to-r from-indigo-500 to-purple-600 flex items-center justify-center text-white font-bold text-sm">E</div> | |
| <span class="text-sm">EverythingAI (EVAI) Text-to-Speech</span> | |
| </div> | |
| <div class="flex space-x-4"> | |
| <a href="#" class="text-sm hover:text-indigo-500 transition">Terms</a> | |
| <a href="#" class="text-sm hover:text-indigo-500 transition">Privacy</a> | |
| <a href="#" class="text-sm hover:text-indigo-500 transition">API Docs</a> | |
| <a href="#" class="text-sm hover:text-indigo-500 transition">Contact</a> | |
| </div> | |
| </div> | |
| <div class="mt-4 text-center md:text-left text-xs text-gray-500 dark:text-gray-400"> | |
| <p>© 2023 EverythingAI. All rights reserved. This demo uses free-tier TTS APIs with rate limits.</p> | |
| </div> | |
| </footer> | |
| </div> | |
| <!-- SSML Help Modal --> | |
| <div id="ssmlHelpModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden"> | |
| <div class="bg-white dark:bg-gray-800 rounded-xl shadow-xl p-6 max-w-2xl w-full max-h-[90vh] overflow-y-auto"> | |
| <div class="flex justify-between items-center mb-4"> | |
| <h3 class="text-xl font-semibold">SSML (Speech Synthesis Markup Language) Help</h3> | |
| <button id="closeSsmlHelp" class="p-2 rounded-full hover:bg-gray-200 dark:hover:bg-gray-700 transition"> | |
| <i class="fas fa-times"></i> | |
| </button> | |
| </div> | |
| <div class="space-y-4 text-sm"> | |
| <p>SSML allows you to control how your text is spoken with special tags and attributes.</p> | |
| <div class="bg-gray-50 dark:bg-gray-700 p-4 rounded-lg"> | |
| <h4 class="font-medium mb-2">Available SSML Features:</h4> | |
| <ul class="space-y-2"> | |
| <li><strong>Emphasis:</strong> Make specific words stand out with different levels of emphasis.</li> | |
| <li><strong>Pauses/Breaks:</strong> Insert pauses between words or sentences.</li> | |
| <li><strong>Numbers/Dates:</strong> Control how numbers, dates, and times are spoken.</li> | |
| <li><strong>Phonetic Pronunciation:</strong> Specify exact pronunciation using IPA.</li> | |
| <li><strong>Prosody:</strong> Adjust rate, pitch, and volume of speech.</li> | |
| </ul> | |
| </div> | |
| <div> | |
| <h4 class="font-medium mb-2">How to use:</h4> | |
| <ol class="list-decimal pl-5 space-y-2"> | |
| <li>Select the text you want to modify</li> | |
| <li>Click the appropriate SSML button</li> | |
| <li>The SSML tags will be inserted automatically</li> | |
| </ol> | |
| </div> | |
| <div class="bg-gray-50 dark:bg-gray-700 p-4 rounded-lg"> | |
| <h4 class="font-medium mb-2">Example:</h4> | |
| <pre class="bg-white dark:bg-gray-800 p-2 rounded text-xs overflow-x-auto"><speak> | |
| This is a <emphasis level="strong">very important</emphasis> point. | |
| <break time="500ms"/> | |
| The number <say-as interpret-as="cardinal">12345</say-as> is large. | |
| </speak></pre> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <script> | |
| // Dark Mode Toggle | |
| const darkModeToggle = document.getElementById('darkModeToggle'); | |
| const html = document.documentElement; | |
| darkModeToggle.addEventListener('click', () => { | |
| html.classList.toggle('dark'); | |
| localStorage.setItem('darkMode', html.classList.contains('dark')); | |
| }); | |
| // Check for saved dark mode preference | |
| if (localStorage.getItem('darkMode') === 'true') { | |
| html.classList.add('dark'); | |
| } else if (localStorage.getItem('darkMode') === 'false') { | |
| html.classList.remove('dark'); | |
| } else if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { | |
| html.classList.add('dark'); | |
| } | |
| // Character Count | |
| const textInput = document.getElementById('textInput'); | |
| const charCount = document.getElementById('charCount'); | |
| textInput.addEventListener('input', () => { | |
| const count = textInput.value.length; | |
| charCount.textContent = `${count} characters`; | |
| // Update preview | |
| document.getElementById('textPreview').innerHTML = `<p>${textInput.value.replace(/\n/g, '<br>')}</p>`; | |
| }); | |
| // Sample Text Button | |
| document.getElementById('sampleBtn').addEventListener('click', () => { | |
| const sampleText = `Welcome to EverythingAI Text-to-Speech. This is a sample text demonstrating the capabilities of our advanced speech synthesis technology. | |
| You can paste your own text, upload documents, or type directly into this field. | |
| Try adjusting the voice settings to find the perfect tone for your needs. The system supports multiple languages and voice styles. | |
| Remember to use SSML tags for enhanced control over pronunciation and emphasis.`; | |
| textInput.value = sampleText; | |
| textInput.dispatchEvent(new Event('input')); | |
| }); | |
| // Clear Button | |
| document.getElementById('clearBtn').addEventListener('click', () => { | |
| textInput.value = ''; | |
| textInput.dispatchEvent(new Event('input')); | |
| }); | |
| // Paste Button | |
| document.getElementById('pasteBtn').addEventListener('click', async () => { | |
| try { | |
| const text = await navigator.clipboard.readText(); | |
| textInput.value = text; | |
| textInput.dispatchEvent(new Event('input')); | |
| } catch (err) { | |
| alert('Failed to paste from clipboard. Please paste manually.'); | |
| } | |
| }); | |
| // File Upload | |
| document.getElementById('fileInput').addEventListener('change', (e) => { | |
| const file = e.target.files[0]; | |
| if (!file) return; | |
| const reader = new FileReader(); | |
| reader.onload = (event) => { | |
| textInput.value = event.target.result; | |
| textInput.dispatchEvent(new Event('input')); | |
| }; | |
| if (file.name.endsWith('.txt')) { | |
| reader.readAsText(file); | |
| } else { | |
| alert('Only plain text (.txt) files are supported in this demo. For PDF and DOCX support, please sign up.'); | |
| } | |
| }); | |
| // Voice Settings Sliders | |
| const speedSlider = document.getElementById('speedSlider'); | |
| const pitchSlider = document.getElementById('pitchSlider'); | |
| const volumeSlider = document.getElementById('volumeSlider'); | |
| speedSlider.addEventListener('input', () => { | |
| document.getElementById('speedValue').textContent = speedSlider.value; | |
| }); | |
| pitchSlider.addEventListener('input', () => { | |
| document.getElementById('pitchValue').textContent = pitchSlider.value; | |
| }); | |
| volumeSlider.addEventListener('input', () => { | |
| document.getElementById('volumeValue').textContent = volumeSlider.value; | |
| }); | |
| // SSML Help Modal | |
| const ssmlHelpModal = document.getElementById('ssmlHelpModal'); | |
| const ssmlHelpBtn = document.getElementById('ssmlHelpBtn'); | |
| const closeSsmlHelp = document.getElementById('closeSsmlHelp'); | |
| ssmlHelpBtn.addEventListener('click', () => { | |
| ssmlHelpModal.classList.remove('hidden'); | |
| }); | |
| closeSsmlHelp.addEventListener('click', () => { | |
| ssmlHelpModal.classList.add('hidden'); | |
| }); | |
| // SSML Buttons | |
| document.querySelectorAll('.ssml-btn').forEach(btn => { | |
| btn.addEventListener('click', () => { | |
| const tag = btn.dataset.tag; | |
| const value = Object.keys(btn.dataset).filter(k => k !== 'tag').map(k => `${k}="${btn.dataset[k]}"`).join(' '); | |
| const start = textInput.selectionStart; | |
| const end = textInput.selectionEnd; | |
| const selectedText = textInput.value.substring(start, end); | |
| if (selectedText) { | |
| let newText; | |
| if (tag === 'phoneme') { | |
| const phoneme = prompt('Enter IPA phonetic pronunciation:'); | |
| if (phoneme) { | |
| newText = `<phoneme alphabet="ipa" ph="${phoneme}">${selectedText}</phoneme>`; | |
| } else { | |
| return; | |
| } | |
| } else { | |
| newText = `<${tag} ${value}>${selectedText}</${tag}>`; | |
| } | |
| textInput.value = textInput.value.substring(0, start) + newText + textInput.value.substring(end); | |
| textInput.dispatchEvent(new Event('input')); | |
| } else { | |
| alert('Please select some text first to apply SSML tags.'); | |
| } | |
| }); | |
| }); | |
| // Audio Player Controls (simulated) | |
| const playBtn = document.getElementById('playBtn'); | |
| const pauseBtn = document.getElementById('pauseBtn'); | |
| const stopBtn = document.getElementById('stopBtn'); | |
| const progressBar = document.getElementById('progressBar'); | |
| const currentTime = document.getElementById('currentTime'); | |
| const durationTime = document.getElementById('durationTime'); | |
| let isPlaying = false; | |
| let progressInterval; | |
| playBtn.addEventListener('click', () => { | |
| if (!textInput.value.trim()) { | |
| alert('Please enter some text first.'); | |
| return; | |
| } | |
| isPlaying = true; | |
| playBtn.innerHTML = '<i class="fas fa-play"></i>'; | |
| // Simulate audio playback with word highlighting | |
| const words = textInput.value.split(/\s+/); | |
| let currentWord = 0; | |
| // Highlight words one by one | |
| const highlightInterval = setInterval(() => { | |
| if (currentWord >= words.length || !isPlaying) { | |
| clearInterval(highlightInterval); | |
| return; | |
| } | |
| // Update preview with highlighting | |
| const preview = document.getElementById('textPreview'); | |
| let html = '<p>'; | |
| for (let i = 0; i < words.length; i++) { | |
| if (i === currentWord) { | |
| html += `<span class="highlight-word">${words[i]}</span> `; | |
| } else { | |
| html += `${words[i]} `; | |
| } | |
| } | |
| html += '</p>'; | |
| preview.innerHTML = html; | |
| // Scroll to highlighted word | |
| const highlighted = preview.querySelector('.highlight-word'); | |
| if (highlighted) { | |
| highlighted.scrollIntoView({ behavior: 'smooth', block: 'center' }); | |
| } | |
| currentWord++; | |
| }, 300); // Adjust speed based on actual speech rate | |
| // Simulate progress bar | |
| let progress = 0; | |
| progressInterval = setInterval(() => { | |
| if (progress >= 100 || !isPlaying) { | |
| clearInterval(progressInterval); | |
| isPlaying = false; | |
| playBtn.innerHTML = '<i class="fas fa-play"></i>'; | |
| return; | |
| } | |
| progress += 1; | |
| progressBar.value = progress; | |
| currentTime.textContent = formatTime(progress); | |
| }, 300); | |
| // Set duration (simulated) | |
| durationTime.textContent = '1:30'; | |
| }); | |
| pauseBtn.addEventListener('click', () => { | |
| isPlaying = false; | |
| playBtn.innerHTML = '<i class="fas fa-play"></i>'; | |
| }); | |
| stopBtn.addEventListener('click', () => { | |
| isPlaying = false; | |
| progressBar.value = 0; | |
| currentTime.textContent = '0:00'; | |
| playBtn.innerHTML = '<i class="fas fa-play"></i>'; | |
| document.getElementById('textPreview').innerHTML = `<p>${textInput.value.replace(/\n/g, '<br>')}</p>`; | |
| }); | |
| function formatTime(percent) { | |
| const totalSeconds = 90; // 1:30 in seconds | |
| const seconds = Math.floor(totalSeconds * percent / 100); | |
| const mins = Math.floor(seconds / 60); | |
| const secs = seconds % 60; | |
| return `${mins}:${secs < 10 ? '0' : ''}${secs}`; | |
| } | |
| // Download Button | |
| document.getElementById('downloadBtn').addEventListener('click', () => { | |
| if (!textInput.value.trim()) { | |
| alert('Please enter some text first.'); | |
| return; | |
| } | |
| alert('In a real implementation, this would generate and download the audio file. This is a demo.'); | |
| }); | |
| // Share Button | |
| document.getElementById('shareBtn').addEventListener('click', () => { | |
| if (!textInput.value.trim()) { | |
| alert('Please enter some text first.'); | |
| return; | |
| } | |
| const shareLinkContainer = document.getElementById('shareLinkContainer'); | |
| const shareLink = document.getElementById('shareLink'); | |
| shareLink.value = `https://everythingai.com/tts/share/${btoa(textInput.value).substring(0, 20)}`; | |
| shareLinkContainer.classList.remove('hidden'); | |
| }); | |
| // Copy Link Button | |
| document.getElementById('copyLinkBtn').addEventListener('click', () => { | |
| const shareLink = document.getElementById('shareLink'); | |
| shareLink.select(); | |
| document.execCommand('copy'); | |
| const copyBtn = document.getElementById('copyLinkBtn'); | |
| copyBtn.innerHTML = '<i class="fas fa-check"></i>'; | |
| setTimeout(() => { | |
| copyBtn.innerHTML = '<i class="fas fa-copy"></i>'; | |
| }, 2000); | |
| }); | |
| // Simulate API quotas | |
| function updateQuotas() { | |
| const googleUsed = Math.floor(Math.random() * 500000); | |
| const googleTotal = 4000000; | |
| const googleRemaining = googleTotal - googleUsed; | |
| const ibmUsed = Math.floor(Math.random() * 2000); | |
| const ibmTotal = 10000; | |
| const ibmRemaining = ibmTotal - ibmUsed; | |
| document.getElementById('googleQuota').textContent = `${googleRemaining.toLocaleString()} chars remaining`; | |
| document.getElementById('ibmQuota').textContent = `${ibmRemaining.toLocaleString()} chars remaining`; | |
| document.getElementById('googleProgress').style.width = `${(googleRemaining / googleTotal) * 100}%`; | |
| document.getElementById('ibmProgress').style.width = `${(ibmRemaining / ibmTotal) * 100}%`; | |
| } | |
| updateQuotas(); | |
| setInterval(updateQuotas, 10000); | |
| </script> | |
| <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=Lawancy/evai" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body> | |
| </html> |