File size: 3,871 Bytes
6cc27a6
ab9f226
dd1b723
 
6cc27a6
 
 
 
 
 
 
 
dd1b723
 
6cc27a6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dd1b723
 
 
6cc27a6
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
```html
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Supertonic TTS - Text to Speech</title>
    <link rel="stylesheet" href="style.css">
    <script type="module">
        import { pipeline } from 'https://cdn.jsdelivr.net/npm/@huggingface/transformers@3.8.0';
        window.pipeline = pipeline;
    </script>
</head>
<body>
    <div class="container">
        <header>
            <div class="header-content">
                <h1>🎙️ Supertonic TTS</h1>
                <p>Transform text to natural speech using cutting-edge AI</p>
                <a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank" class="anycoder-badge" aria-label="Built with anycoder">
                    Built with anycoder
                </a>
            </div>
        </header>

        <main class="main-content">
            <div class="controls">
                <div class="input-section">
                    <label for="textInput" class="sr-only">Enter text to convert to speech</label>
                    <textarea 
                        id="textInput" 
                        placeholder="Type your text here... (e.g., 'Hello, this is a test of the Supertonic TTS system!')"
                        rows="4"
                        maxlength="500"
                    ></textarea>
                    <div class="input-info">
                        <span id="charCount">0/500</span>
                    </div>
                </div>

                <div class="voice-section">
                    <label for="voiceSelect" class="voice-label">Voice:</label>
                    <select id="voiceSelect">
                        <option value="F1">Female 1</option>
                        <option value="F2">Female 2</option>
                        <option value="M1">Male 1</option>
                        <option value="M2">Male 2</option>
                    </select>
                </div>

                <div class="device-section">
                    <label class="device-toggle-label">
                        <input type="checkbox" id="deviceToggle" />
                        <span class="toggle-switch">
                            <span class="toggle-knob"></span>
                        </span>
                        <span class="toggle-text">
                            <span id="deviceText">CPU Mode</span>
                        </span>
                    </label>
                </div>

                <button id="generateBtn" class="generate-btn" disabled>
                    <span class="btn-content">
                        <span class="btn-text">Generate Speech</span>
                        <div class="spinner" style="display: none;"></div>
                    </span>
                </button>
            </div>

            <div id="status" class="status hidden"></div>

            <div id="audioSection" class="audio-section hidden">
                <div class="audio-controls">
                    <button id="playBtn" class="play-btn" aria-label="Play audio">
                        <svg viewBox="0 0 24 24" fill="currentColor">
                            <path d="M8 5v14l11-7z"/>
                        </svg>
                    </button>
                    <button id="downloadBtn" class="download-btn" aria-label="Download audio">
                        <svg viewBox="0 0 24 24" fill="currentColor">
                            <path d="M12 10.587l3.95 2.483-3.95 2.483V10.587zM12 3L4 9h8v12h4V9h8l-8-6z"/>
                        </svg>
                    </button>
                </div>
                <audio id="audioPlayer" controls style="display: none;"></audio>
            </div>
        </main>
    </div>

    <script src="index.js" type="module"></script>
</body>
</html>
```