File size: 5,787 Bytes
b9d9359
 
 
 
 
 
 
5eaf0af
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b9d9359
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5eaf0af
 
 
 
b9d9359
 
 
 
 
45aa882
b9d9359
 
 
 
 
5eaf0af
b9d9359
 
 
 
 
 
 
 
 
 
 
 
 
 
5eaf0af
b9d9359
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5eaf0af
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Convertidor de Texto a Audio</title>
    <style>
      body {
          background-color: #222;
          color: #eee;
          font-family: Arial, sans-serif;
          text-align: center;
          margin: 0;
          padding: 0;
      }
      h1 {
          margin-top: 50px;
      }
      form {
          margin-top: 20px;
          display: flex;
          flex-direction: column;
          align-items: center;
      }
      label, select, textarea {
          margin: 5px;
          font-size: 16px;
          color: #eee;
      }
      textarea {
          background-color: #333;
          color: #eee;
          border: 1px solid #666;
          border-radius: 5px;
          padding: 10px;
          width: 90%;
          height: 100px;
      }
      select {
          background-color: #333;
          color: #eee;
          border: 1px solid #666;
          border-radius: 5px;
          padding: 5px;
          width: 80%;
          height: 30px;
      }
      button {
            background-color: #007bff;
            color: #eee;
            border: none;
            border-radius: 5px;
            padding: 10px 20px;
            cursor: pointer;
            transition: background-color 0.3s ease;
        }
        button:hover {
            background-color: #0056b3;
        }
        #audio-container {
            margin-top: 20px;
        }
.animated-button {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 16px 36px;
  border: 4px solid;
  border-color: transparent;
  font-size: 16px;
  background-color: inherit;
  border-radius: 100px;
  font-weight: 600;
  color: greenyellow;
  box-shadow: 0 0 0 2px greenyellow;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}
.animated-button svg {
  position: absolute;
  width: 24px;
  fill: greenyellow;
  z-index: 9;
  transition: all 0.8s cubic-bezier(0.23, 1, 0.32, 1);
}
.animated-button .arr-1 {
  right: 16px;
}
.animated-button .arr-2 {
  left: -25%;
}
.animated-button .circle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  background-color: rgb(208, 162, 246);
  border-radius: 50%;
  opacity: 0;
  transition: all 0.8s cubic-bezier(0.23, 1, 0.32, 1);
}
.animated-button .text {
  position: relative;
  z-index: 1;
  transform: translateX(-12px);
  transition: all 0.8s cubic-bezier(0.23, 1, 0.32, 1);
}
.animated-button:hover {
  box-shadow: 0 0 0 12px transparent;
  color: #212121;
  border-radius: 12px;
}
.animated-button:hover .arr-1 {
  right: -25%;
}
.animated-button:hover .arr-2 {
  left: 16px;
}
.animated-button:hover .text {
  transform: translateX(12px);
}
.animated-button:hover svg {
  fill: #212121;
}
.animated-button:active {
  scale: 0.95;
  box-shadow: 0 0 0 4px rgb(47, 196, 255);
}
.animated-button:hover .circle {
  width: 220px;
  height: 220px;
  opacity: 1;
}
      #audio-container {
          margin-top: 20px;
      }
  </style>
</head>
<body>
    <h1>Convertidor de Texto a Audio</h1>
    <form action="/convert" method="post">
        <label for="model">Selecciona el modelo ONNX:</label><br>
<div> <p>Prueba nuevos modelos avanzados en HirLab:</p> <a href="https://tts.hircoir.eu.org" style="color: #ADD8E6;" target="_blank"> Modelos disponibles: Sora Español México, Voz HirCoir, Kamora Español México </a> <p>Try new advanced models at HirLab:</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">
            {% for model in model_options %}
            <option value="{{ model }}">{{ model }}</option>
            {% endfor %}
        </select><br>
        <label for="text">Texto:</label><br>
              <textarea placeholder="Escribe tu texto aquí, solo se tomará los primeros 500 carácteres." id="text" name="text" rows="4"></textarea>
        <button class="animated-button">
            <svg viewBox="0 0 24 24" class="arr-2" xmlns="http://www.w3.org/2000/svg">
              <path
                d="M16.1716 10.9999L10.8076 5.63589L12.2218 4.22168L20 11.9999L12.2218 19.778L10.8076 18.3638L16.1716 12.9999H4V10.9999H16.1716Z"
              ></path>
            </svg>
            <span class="text">Generar audio</span>
            <span class="circle"></span>
            <svg viewBox="0 0 24 24" class="arr-1" xmlns="http://www.w3.org/2000/svg">
              <path
                d="M16.1716 10.9999L10.8076 5.63589L12.2218 4.22168L20 11.9999L12.2218 19.778L10.8076 18.3638L16.1716 12.9999H4V10.9999H16.1716Z"
              ></path>
            </svg>
          </button>

    </form>
    <div id="audio-container"></div>

    <script>
        document.querySelector('form').addEventListener('submit', async function (e) {
            e.preventDefault();
            const formData = new FormData(e.target);
            const response = await fetch('/convert', {
                method: 'POST',
                body: formData
            });
            const data = await response.json();
            const audioContent = data.audio_base64;
            const audioElement = document.createElement('audio');
            audioElement.src = 'data:audio/wav;base64,' + audioContent;
            audioElement.controls = true;
            audioElement.autoplay = true; // Autoreproducción del audio
            document.getElementById('audio-container').innerHTML = '';
            document.getElementById('audio-container').appendChild(audioElement);
        });
    </script>
</body>