hivecorp commited on
Commit
12e7599
·
verified ·
1 Parent(s): bbfbeba

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +127 -19
index.html CHANGED
@@ -1,19 +1,127 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Free Voice</title>
7
+ <style>
8
+ body {
9
+ font-family: Arial, sans-serif;
10
+ max-width: 800px;
11
+ margin: 0 auto;
12
+ padding: 20px;
13
+ background-color: #f0f0f0;
14
+ }
15
+
16
+ h1 {
17
+ text-align: center;
18
+ color: #2c3e50;
19
+ margin-bottom: 40px;
20
+ }
21
+
22
+ .audio-container {
23
+ background-color: white;
24
+ padding: 20px;
25
+ border-radius: 10px;
26
+ box-shadow: 0 2px 5px rgba(0,0,0,0.1);
27
+ }
28
+
29
+ .audio-item {
30
+ display: flex;
31
+ justify-content: space-between;
32
+ align-items: center;
33
+ padding: 15px;
34
+ margin: 10px 0;
35
+ background-color: #f8f9fa;
36
+ border-radius: 5px;
37
+ transition: background-color 0.3s;
38
+ }
39
+
40
+ .audio-item:hover {
41
+ background-color: #e9ecef;
42
+ }
43
+
44
+ .play-button {
45
+ background-color: #3498db;
46
+ color: white;
47
+ border: none;
48
+ padding: 8px 15px;
49
+ border-radius: 5px;
50
+ cursor: pointer;
51
+ transition: background-color 0.3s;
52
+ }
53
+
54
+ .play-button:hover {
55
+ background-color: #2980b9;
56
+ }
57
+
58
+ audio {
59
+ display: none;
60
+ }
61
+ </style>
62
+ </head>
63
+ <body>
64
+ <h1>Free Voice</h1>
65
+ <div class="audio-container" id="audioContainer"></div>
66
+
67
+ <script>
68
+ const voices = [
69
+ { name: "John Doe", file: "john_doe.mp3" },
70
+ { name: "Jane Smith", file: "jane_smith.mp3" },
71
+ { name: "Michael Johnson", file: "michael_johnson.mp3" },
72
+ { name: "Emily Davis", file: "emily_davis.mp3" },
73
+ { name: "David Wilson", file: "david_wilson.mp3" },
74
+ { name: "Sarah Brown", file: "sarah_brown.mp3" },
75
+ { name: "James Miller", file: "james_miller.mp3" },
76
+ { name: "Linda Taylor", file: "linda_taylor.mp3" }
77
+ ];
78
+
79
+ const container = document.getElementById('audioContainer');
80
+ let currentAudio = null;
81
+
82
+ voices.forEach(voice => {
83
+ const audioElement = document.createElement('audio');
84
+ audioElement.src = `audio/${voice.file}`;
85
+ audioElement.id = `audio_${voice.name.replace(/\s+/g, '_')}`;
86
+
87
+ const itemDiv = document.createElement('div');
88
+ itemDiv.className = 'audio-item';
89
+
90
+ const nameSpan = document.createElement('span');
91
+ nameSpan.textContent = voice.name;
92
+
93
+ const playButton = document.createElement('button');
94
+ playButton.className = 'play-button';
95
+ playButton.textContent = 'Play';
96
+ playButton.onclick = () => toggleAudio(audioElement, playButton);
97
+
98
+ itemDiv.appendChild(nameSpan);
99
+ itemDiv.appendChild(playButton);
100
+ container.appendChild(itemDiv);
101
+ container.appendChild(audioElement);
102
+ });
103
+
104
+ function toggleAudio(audioElement, button) {
105
+ if (currentAudio && currentAudio !== audioElement) {
106
+ currentAudio.pause();
107
+ currentAudio.previousElementSibling.textContent = 'Play';
108
+ }
109
+
110
+ if (audioElement.paused) {
111
+ audioElement.play();
112
+ button.textContent = 'Pause';
113
+ currentAudio = audioElement;
114
+ } else {
115
+ audioElement.pause();
116
+ button.textContent = 'Play';
117
+ currentAudio = null;
118
+ }
119
+
120
+ audioElement.addEventListener('ended', () => {
121
+ button.textContent = 'Play';
122
+ currentAudio = null;
123
+ });
124
+ }
125
+ </script>
126
+ </body>
127
+ </html>