HirCoir commited on
Commit
90a1590
1 Parent(s): e064e8d

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +91 -159
index.html CHANGED
@@ -1,53 +1,51 @@
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>Model</title>
 
7
  <style>
8
- body {
9
- background-color: #222;
10
- color: #eee;
11
- font-family: Arial, sans-serif;
12
- text-align: center;
13
- margin: 0;
14
- padding: 0;
15
- }
16
- h1 {
17
- margin-top: 50px;
18
- }
19
- form {
20
- margin-top: 20px;
21
- display: flex;
22
- flex-direction: column;
23
- align-items: center;
24
- }
25
- label, select, textarea {
26
- margin: 5px;
27
- font-size: 16px;
28
- color: #eee;
29
- }
30
- textarea {
31
- background-color: #333;
32
- color: #eee;
33
- border: 1px solid #666;
34
- border-radius: 5px;
35
- padding: 10px;
36
- width: 90%;
37
- height: 100px;
38
- }
39
- select {
40
- background-color: #333;
41
- color: #eee;
42
- border: 1px solid #666;
43
- border-radius: 5px;
44
- padding: 5px;
45
- width: 80%;
46
- height: 30px;
47
- }
48
- button {
49
- background-color: #007bff;
50
  color: #eee;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  border: none;
52
  border-radius: 5px;
53
  padding: 10px 20px;
@@ -59,132 +57,66 @@
59
  }
60
  #audio-container {
61
  margin-top: 20px;
 
 
 
 
 
 
 
 
 
 
 
62
  }
63
- .animated-button {
64
- position: relative;
65
- display: flex;
66
- align-items: center;
67
- gap: 4px;
68
- padding: 16px 36px;
69
- border: 4px solid;
70
- border-color: transparent;
71
- font-size: 16px;
72
- background-color: inherit;
73
- border-radius: 100px;
74
- font-weight: 600;
75
- color: greenyellow;
76
- box-shadow: 0 0 0 2px greenyellow;
77
- cursor: pointer;
78
- overflow: hidden;
79
- transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
80
- }
81
- .animated-button svg {
82
- position: absolute;
83
- width: 24px;
84
- fill: greenyellow;
85
- z-index: 9;
86
- transition: all 0.8s cubic-bezier(0.23, 1, 0.32, 1);
87
- }
88
- .animated-button .arr-1 {
89
- right: 16px;
90
- }
91
- .animated-button .arr-2 {
92
- left: -25%;
93
- }
94
- .animated-button .circle {
95
- position: absolute;
96
- top: 50%;
97
- left: 50%;
98
- transform: translate(-50%, -50%);
99
- width: 20px;
100
- height: 20px;
101
- background-color: rgb(208, 162, 246);
102
- border-radius: 50%;
103
- opacity: 0;
104
- transition: all 0.8s cubic-bezier(0.23, 1, 0.32, 1);
105
- }
106
- .animated-button .text {
107
- position: relative;
108
- z-index: 1;
109
- transform: translateX(-12px);
110
- transition: all 0.8s cubic-bezier(0.23, 1, 0.32, 1);
111
- }
112
- .animated-button:hover {
113
- box-shadow: 0 0 0 12px transparent;
114
- color: #212121;
115
- border-radius: 12px;
116
- }
117
- .animated-button:hover .arr-1 {
118
- right: -25%;
119
- }
120
- .animated-button:hover .arr-2 {
121
- left: 16px;
122
- }
123
- .animated-button:hover .text {
124
- transform: translateX(12px);
125
- }
126
- .animated-button:hover svg {
127
- fill: #212121;
128
- }
129
- .animated-button:active {
130
- scale: 0.95;
131
- box-shadow: 0 0 0 4px rgb(47, 196, 255);
132
- }
133
- .animated-button:hover .circle {
134
- width: 220px;
135
- height: 220px;
136
- opacity: 1;
137
- }
138
- #audio-container {
139
- margin-top: 20px;
140
- }
141
- </style>
142
  </head>
143
  <body>
144
  <h1>Convertidor de Texto a Audio</h1>
145
- <form action="/convert" method="post">
146
- <label for="model">Selecciona el modelo ONNX:</label><br>
147
- <div> Files > Dockerfile > Read Dockerfile</p> <a href="https://tts.hircoir.eu.org" style="color: #ADD8E6;" target="_blank"> Available models: Sora Spanish Mexico, Voz HirCoir, Kamora Spanish Mexico </a> </div> <select id="model" name="model">
148
  {% for model in model_options %}
149
  <option value="{{ model }}">{{ model }}</option>
150
  {% endfor %}
151
- </select><br>
152
- <label for="text">Texto:</label><br>
153
- <textarea placeholder="Escribe tu texto aquí, solo se tomará los primeros 500 carácteres." id="text" name="text" rows="4"></textarea>
154
- <button class="animated-button">
155
- <svg viewBox="0 0 24 24" class="arr-2" xmlns="http://www.w3.org/2000/svg">
156
- <path
157
- d="M16.1716 10.9999L10.8076 5.63589L12.2218 4.22168L20 11.9999L12.2218 19.778L10.8076 18.3638L16.1716 12.9999H4V10.9999H16.1716Z"
158
- ></path>
159
- </svg>
160
- <span class="text">Generar audio</span>
161
- <span class="circle"></span>
162
- <svg viewBox="0 0 24 24" class="arr-1" xmlns="http://www.w3.org/2000/svg">
163
- <path
164
- d="M16.1716 10.9999L10.8076 5.63589L12.2218 4.22168L20 11.9999L12.2218 19.778L10.8076 18.3638L16.1716 12.9999H4V10.9999H16.1716Z"
165
- ></path>
166
- </svg>
167
- </button>
168
-
169
  </form>
 
170
  <div id="audio-container"></div>
171
-
 
 
 
172
  <script>
173
- document.querySelector('form').addEventListener('submit', async function (e) {
174
  e.preventDefault();
175
  const formData = new FormData(e.target);
176
- const response = await fetch('/convert', {
177
- method: 'POST',
178
- body: formData
179
- });
180
- const data = await response.json();
181
- const audioContent = data.audio_base64;
182
- const audioElement = document.createElement('audio');
183
- audioElement.src = 'data:audio/wav;base64,' + audioContent;
184
- audioElement.controls = true;
185
- audioElement.autoplay = true; // Autoreproducción del audio
186
- document.getElementById('audio-container').innerHTML = '';
187
- document.getElementById('audio-container').appendChild(audioElement);
 
 
 
 
 
 
 
 
188
  });
 
 
189
  </script>
190
- </body>
 
 
1
  <!DOCTYPE html>
2
+ <html lang="es">
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Inference</title>
7
+
8
  <style>
9
+ body {
10
+ background-color: #222;
11
+ color: #fff;
12
+ font-family: Arial, sans-serif;
13
+ text-align: center;
14
+ margin: 0;
15
+ padding: 0;
16
+ overflow-x: hidden; /* Para evitar el scrolling horizontal */
17
+ }
18
+ h1 {
19
+ margin-top: 50px;
20
+ font-size: 24px;
21
+ }
22
+ form {
23
+ margin-top: 20px;
24
+ display: flex;
25
+ flex-direction: column;
26
+ align-items: center;
27
+ max-width: 90%;
28
+ margin: 0 auto;
29
+ }
30
+ label, select, textarea {
31
+ margin: 5px;
32
+ font-size: 16px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  color: #eee;
34
+ border: 1px solid #666;
35
+ border-radius: 5px;
36
+ background-color: #333;
37
+ padding: 1px;
38
+ width: 100%;
39
+ max-height: calc(100vh - 400px); /* Altura máxima del textarea */
40
+ overflow-y: auto; /* Hacer el textarea desplazable cuando sea necesario */
41
+ }
42
+ select {
43
+ height: 30px;
44
+ }
45
+ button {
46
+ margin-top: 10px;
47
+ background-color: #007bff;
48
+ color: #fff;
49
  border: none;
50
  border-radius: 5px;
51
  padding: 10px 20px;
 
57
  }
58
  #audio-container {
59
  margin-top: 20px;
60
+ max-width: 90%;
61
+ margin: 0 auto;
62
+ }
63
+ footer {
64
+ position: fixed;
65
+ bottom: 0;
66
+ width: 100%;
67
+ background-color: #333;
68
+ color: #eee;
69
+ padding: 10px 0;
70
+ text-align: center;
71
  }
72
+ </style>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  </head>
74
  <body>
75
  <h1>Convertidor de Texto a Audio</h1>
76
+ <form id="conversion-form">
77
+ <label for="model">Modelo:</label>
78
+ <select id="model" name="model">
79
  {% for model in model_options %}
80
  <option value="{{ model }}">{{ model }}</option>
81
  {% endfor %}
82
+ </select>
83
+ <label for="text">Texto:</label>
84
+ <textarea id="text" name="text" rows="4" maxlength="3000" placeholder="Escribe tu texto aquí." class="autosize"></textarea>
85
+ <button type="submit">Generar audio</button>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
  </form>
87
+ <br>
88
  <div id="audio-container"></div>
89
+ <footer>
90
+ <p>Powered by <a target="_blank" href="https://hircoir.eu.org" class="style color" style="color: green;">HirCoir</a></p>
91
+ </footer>
92
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/autosize.js/4.0.2/autosize.min.js"></script>
93
  <script>
94
+ document.getElementById('conversion-form').addEventListener('submit', async function (e) {
95
  e.preventDefault();
96
  const formData = new FormData(e.target);
97
+ try {
98
+ const response = await fetch('/convert', {
99
+ method: 'POST',
100
+ body: formData
101
+ });
102
+ if (response.ok) {
103
+ const data = await response.json();
104
+ const audioContent = data.audio_base64;
105
+ const audioElement = document.createElement('audio');
106
+ audioElement.src = 'data:audio/wav;base64,' + audioContent;
107
+ audioElement.controls = true;
108
+ audioElement.autoplay = true;
109
+ document.getElementById('audio-container').innerHTML = '';
110
+ document.getElementById('audio-container').appendChild(audioElement);
111
+ } else {
112
+ console.error('Error al convertir texto a voz:', response.statusText);
113
+ }
114
+ } catch (error) {
115
+ console.error('Error de red:', error);
116
+ }
117
  });
118
+
119
+ autosize(document.querySelectorAll('.autosize'));
120
  </script>
121
+ </body>
122
+ </html>