File size: 928 Bytes
7e35717 9d9db50 36195b3 9d9db50 36195b3 7e35717 1b3cee2 a8efcc2 1b3cee2 a8efcc2 36195b3 9d9db50 36195b3 a8efcc2 1b3cee2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
import os, asyncio
import gradio as gr
CORRECT_PASSWORD = os.getenv("APP_PASSWORD") # Ensure this is set in your environment
async def login(password: str):
"""
Verify the password. Returns a tuple to update the Gradio UI.
"""
if password == CORRECT_PASSWORD:
yield gr.update(visible=False), gr.update(visible=True), ""
elif password == "hunter2":
# Temporarily show the app
yield gr.update(visible=False), gr.update(visible=True), ""
await asyncio.sleep(2)
yield gr.update(visible=True), gr.update(visible=False), "Nice try ❤️"
await asyncio.sleep(6)
yield gr.update(visible=True), gr.update(visible=False), ""
else:
yield gr.update(visible=True), gr.update(visible=False), "❌ Incorrect password. Please try again or contact Ben."
await asyncio.sleep(6)
yield gr.update(visible=True), gr.update(visible=False), ""
|