Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -125,19 +125,45 @@ Sintetizador de voz con la voz del locutor argentino Pedro Labattaglia.
|
|
125 |
- Presione generar voz
|
126 |
"""
|
127 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
# Interfaz de Gradio
|
129 |
with gr.Blocks(theme=theme) as demo:
|
130 |
gr.Markdown(description)
|
131 |
|
132 |
# Fila para centrar la imagen
|
133 |
with gr.Row():
|
134 |
-
with gr.Column(equal_height=True):
|
135 |
gr.Image(
|
136 |
"https://www.labattaglia.com.ar/images/about_me_pic2.jpg",
|
137 |
label="",
|
138 |
show_label=False,
|
139 |
-
container=False,
|
140 |
-
elem_id="image-container"
|
141 |
)
|
142 |
|
143 |
# Fila para seleccionar idioma, referencia y generar voz
|
@@ -159,14 +185,17 @@ with gr.Blocks(theme=theme) as demo:
|
|
159 |
outputs=[generated_audio, metrics_output]
|
160 |
)
|
161 |
|
|
|
|
|
|
|
162 |
# Estilos CSS personalizados
|
163 |
demo.css = """
|
164 |
#image-container img {
|
165 |
display: block;
|
166 |
margin-left: auto;
|
167 |
margin-right: auto;
|
168 |
-
max-width: 256px;
|
169 |
-
height: auto;
|
170 |
}
|
171 |
"""
|
172 |
|
|
|
125 |
- Presione generar voz
|
126 |
"""
|
127 |
|
128 |
+
# JavaScript para limpiar los datos de autenticación
|
129 |
+
clear_auth_js = """
|
130 |
+
function clearAuthData() {
|
131 |
+
localStorage.removeItem('gradio_auth_token');
|
132 |
+
localStorage.removeItem('gradio_auth_expiration');
|
133 |
+
}
|
134 |
+
|
135 |
+
// Limpiar datos de autenticación cuando la página se refresca o se cierra
|
136 |
+
window.addEventListener('beforeunload', clearAuthData);
|
137 |
+
|
138 |
+
// Agregar un botón para limpiar manualmente los datos de autenticación
|
139 |
+
document.addEventListener('DOMContentLoaded', (event) => {
|
140 |
+
const clearAuthButton = document.createElement('button');
|
141 |
+
clearAuthButton.textContent = 'Cerrar sesión';
|
142 |
+
clearAuthButton.style.position = 'fixed';
|
143 |
+
clearAuthButton.style.top = '10px';
|
144 |
+
clearAuthButton.style.right = '10px';
|
145 |
+
clearAuthButton.style.zIndex = '1000';
|
146 |
+
clearAuthButton.onclick = function() {
|
147 |
+
clearAuthData();
|
148 |
+
alert('Sesión cerrada. Por favor, recarga la página.');
|
149 |
+
};
|
150 |
+
document.body.appendChild(clearAuthButton);
|
151 |
+
});
|
152 |
+
"""
|
153 |
+
|
154 |
# Interfaz de Gradio
|
155 |
with gr.Blocks(theme=theme) as demo:
|
156 |
gr.Markdown(description)
|
157 |
|
158 |
# Fila para centrar la imagen
|
159 |
with gr.Row():
|
160 |
+
with gr.Column(equal_height=True):
|
161 |
gr.Image(
|
162 |
"https://www.labattaglia.com.ar/images/about_me_pic2.jpg",
|
163 |
label="",
|
164 |
show_label=False,
|
165 |
+
container=False,
|
166 |
+
elem_id="image-container"
|
167 |
)
|
168 |
|
169 |
# Fila para seleccionar idioma, referencia y generar voz
|
|
|
185 |
outputs=[generated_audio, metrics_output]
|
186 |
)
|
187 |
|
188 |
+
# Agregar el JavaScript para limpiar los datos de autenticación
|
189 |
+
gr.HTML("<script>" + clear_auth_js + "</script>")
|
190 |
+
|
191 |
# Estilos CSS personalizados
|
192 |
demo.css = """
|
193 |
#image-container img {
|
194 |
display: block;
|
195 |
margin-left: auto;
|
196 |
margin-right: auto;
|
197 |
+
max-width: 256px;
|
198 |
+
height: auto;
|
199 |
}
|
200 |
"""
|
201 |
|