Update app.py
Browse files
app.py
CHANGED
@@ -1,16 +1,19 @@
|
|
1 |
import gradio as gr
|
2 |
import os
|
|
|
3 |
|
4 |
def echo(name, request: gr.Request):
|
5 |
if request:
|
|
|
|
|
6 |
print("Request headers dictionary:", request.headers)
|
7 |
print("IP address:", request.client.host)
|
8 |
return str(request.headers), str(request.client.host)
|
9 |
|
10 |
def verify_auth(username, password):
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
return True
|
15 |
else:
|
16 |
return False
|
|
|
1 |
import gradio as gr
|
2 |
import os
|
3 |
+
global auth_value = False
|
4 |
|
5 |
def echo(name, request: gr.Request):
|
6 |
if request:
|
7 |
+
if dict(request.headers)['origin'] in os.environ["ORIGIN"]:
|
8 |
+
global auth_value = True
|
9 |
print("Request headers dictionary:", request.headers)
|
10 |
print("IP address:", request.client.host)
|
11 |
return str(request.headers), str(request.client.host)
|
12 |
|
13 |
def verify_auth(username, password):
|
14 |
+
if global auth_value = True:
|
15 |
+
return True
|
16 |
+
elif username=="admin" and password=="admin":
|
17 |
return True
|
18 |
else:
|
19 |
return False
|