Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -201,65 +201,46 @@ custom_css = """
|
|
201 |
}
|
202 |
"""
|
203 |
|
204 |
-
#
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
"""
|
214 |
-
|
215 |
-
""
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
inputs=[input_text, language_selector, reference_audio],
|
245 |
-
outputs=[generated_audio, metrics_output]
|
246 |
-
)
|
247 |
-
|
248 |
-
# Formulario de inicio de sesión personalizado (en español)
|
249 |
-
login_form = """
|
250 |
-
<div class="login-container">
|
251 |
-
<h1>Bienvenido al sintetizador de voz de Pedro Labattaglia</h1>
|
252 |
-
<p>Por favor, introduzca sus credenciales para acceder.</p>
|
253 |
-
<form id="login-form">
|
254 |
-
<input type="text" id="username" name="username" placeholder="Usuario" required>
|
255 |
-
<input type="password" id="password" name="password" placeholder="Contraseña" required>
|
256 |
-
<button type="submit">Iniciar sesión</button>
|
257 |
-
</form>
|
258 |
-
</div>
|
259 |
-
"""
|
260 |
|
261 |
if __name__ == "__main__":
|
262 |
-
demo.launch(
|
263 |
-
auth=[("Pedro Labattaglia", "PL2024"), ("Invitado", "PLTTS2024")],
|
264 |
-
auth_message=login_form
|
265 |
-
)
|
|
|
201 |
}
|
202 |
"""
|
203 |
|
204 |
+
# Modificar la parte del formulario de inicio de sesión
|
205 |
+
def custom_auth(username, password):
|
206 |
+
if (username, password) in [("Pedro Labattaglia", "PL2024"), ("Invitado", "PLTTS2024")]:
|
207 |
+
return True
|
208 |
+
return False
|
209 |
+
|
210 |
+
iface = gr.Interface(
|
211 |
+
fn=predict,
|
212 |
+
inputs=[
|
213 |
+
gr.Textbox(label="Texto a sintetizar", placeholder="Escribe aquí el texto que quieres convertir a voz..."),
|
214 |
+
gr.Dropdown(label="Idioma", choices=supported_languages),
|
215 |
+
gr.Dropdown(label="Audio de referencia", choices=reference_audios)
|
216 |
+
],
|
217 |
+
outputs=[
|
218 |
+
gr.Audio(label="Audio generado"),
|
219 |
+
gr.Textbox(label="Métricas")
|
220 |
+
],
|
221 |
+
title="Sintetizador de voz de Pedro Labattaglia",
|
222 |
+
description=description,
|
223 |
+
theme=theme,
|
224 |
+
css=custom_css,
|
225 |
+
allow_flagging="never"
|
226 |
+
)
|
227 |
+
|
228 |
+
# Crear una nueva interfaz para el inicio de sesión
|
229 |
+
login_iface = gr.Interface(
|
230 |
+
fn=custom_auth,
|
231 |
+
inputs=[
|
232 |
+
gr.Textbox(label="Usuario", placeholder="Ingrese su nombre de usuario"),
|
233 |
+
gr.Textbox(label="Contraseña", type="password", placeholder="Ingrese su contraseña")
|
234 |
+
],
|
235 |
+
outputs=gr.Textbox(visible=False),
|
236 |
+
title="Bienvenido al sintetizador de voz de Pedro Labattaglia",
|
237 |
+
description="Por favor, introduzca sus credenciales para acceder.",
|
238 |
+
theme=theme,
|
239 |
+
css=custom_css
|
240 |
+
)
|
241 |
+
|
242 |
+
# Combinar las interfaces
|
243 |
+
demo = gr.TabbedInterface([login_iface, iface], ["Login", "Sintetizador"])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
244 |
|
245 |
if __name__ == "__main__":
|
246 |
+
demo.launch()
|
|
|
|
|
|