iamrobotbear's picture
Update app.py
825bf64
raw
history blame
1.96 kB
import gradio as gr
import os
ok = os.getenv("P")
def checks(pass_box, cnt):
if str(pass_box) != str(ok):
if int(cnt) > 0:
head = gr.Markdown.update("""<center><h1>Enter Secret Password</h1><h7>(the password is: password)</h7></center>""")
pass_box = gr.Textbox.update(value=None, placeholder=f"{cnt} tries remaining")
check = gr.update(visible=True)
granted = gr.update(visible=False)
cnt = int(cnt) - 1
else:
head = gr.Markdown.update("""<center><h1>Access Denied</h1><h7>Reload Page to try again</h7></center>""")
pass_box = gr.update(visible=False)
check = gr.update(visible=False)
granted = gr.update(visible=False)
pass
elif str(pass_box) == str(ok):
gr.Interface.load("spaces/eugenesiow/remove-bg").launch()
pass_box = gr.update(visible=False)
check = gr.update(visible=False)
granted = gr.update(visible=True)
else:
pass
return head, pass_box, check, granted, cnt
with gr.Blocks() as sentry:
head = gr.Markdown("""<center><h1>Enter Secret Password</h1><h7></h7></center>""")
with gr.Row(visible=True) as check:
gr.Column()
with gr.Column():
pass_box = gr.Textbox(label="Enter Secret Password")
pass_btn = gr.Button("Submit", visible=True)
gr.Column()
with gr.Row(visible=False) as granted:
gr.Column()
with gr.Column():
words = gr.Markdown("""""")
this = gr.Textbox()
that = gr.Image()
btn = gr.Button()
cnt = gr.Textbox(value=5, visible=False, interactive=False)
gr.Column()
pass_btn.click(checks, [pass_box, cnt], [head, pass_box, check, granted, cnt], show_progress=False)
#sentry.launch(show_api=False, enable_queue=False)
sentry.launch(server_name="0.0.0.0", server_port=7860)