iamrobotbear commited on
Commit
af86463
·
1 Parent(s): bb7d4ff

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -47
app.py CHANGED
@@ -1,50 +1,5 @@
1
  import gradio as gr
2
  import os
3
- ok = os.getenv("P")
4
-
5
- def checks(pass_box, cnt):
6
-
7
- if str(pass_box) != str(ok):
8
- if int(cnt) > 0:
9
- head = gr.Markdown.update("""<center><h1>Enter Secret Password</h1><h7>(the password is: password)</h7></center>""")
10
- pass_box = gr.Textbox.update(value=None, placeholder=f"{cnt} tries remaining")
11
- check = gr.update(visible=True)
12
- granted = gr.update(visible=False)
13
- cnt = int(cnt) - 1
14
- else:
15
- head = gr.Markdown.update("""<center><h1>Access Denied</h1><h7>Reload Page to try again</h7></center>""")
16
- pass_box = gr.update(visible=False)
17
- check = gr.update(visible=False)
18
- granted = gr.update(visible=False)
19
- pass
20
- elif str(pass_box) == str(ok):
21
- block = gr.Blocks()
22
- block.launch(server_name="0.0.0.0", server_port=7860)
23
- pass_box = gr.update(visible=False)
24
- check = gr.update(visible=False)
25
- granted = gr.update(visible=True)
26
- else:
27
- pass
28
- return head, pass_box, check, granted, cnt
29
-
30
- with gr.Blocks() as sentry:
31
- head = gr.Markdown("""<center><h1>Enter Secret Password</h1><h7></h7></center>""")
32
-
33
- with gr.Row(visible=True) as check:
34
- gr.Column()
35
- with gr.Column():
36
- pass_box = gr.Textbox(label="Enter Secret Password")
37
- pass_btn = gr.Button("Submit", visible=True)
38
- gr.Column()
39
- with gr.Row(visible=False) as granted:
40
- gr.Column()
41
- with gr.Column():
42
- words = gr.Markdown("""""")
43
- this = gr.Textbox()
44
- that = gr.Image()
45
- btn = gr.Button()
46
- cnt = gr.Textbox(value=5, visible=False, interactive=False)
47
- gr.Column()
48
- pass_btn.click(checks, [pass_box, cnt], [head, pass_box, check, granted, cnt], show_progress=False)
49
- sentry.launch(show_api=False, enable_queue=False)
50
 
 
 
 
1
  import gradio as gr
2
  import os
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
 
4
+ demo = gr.Interface.load("spaces/camenduru/webui-docker")
5
+ demo.launch(enable_queue=False, auth=("username", "password"), auth_message="Try this")