Update app.py
Browse files
app.py
CHANGED
@@ -5,8 +5,24 @@ access_token = os.environ.get('HF_TOKEN')
|
|
5 |
|
6 |
ui = gr.load("sun000090/gradio_space", hf_token=access_token, src="spaces")
|
7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
def environ_auth(username, password):
|
9 |
-
|
|
|
10 |
return True
|
11 |
else:
|
12 |
return False
|
|
|
5 |
|
6 |
ui = gr.load("sun000090/gradio_space", hf_token=access_token, src="spaces")
|
7 |
|
8 |
+
# def environ_auth(username, password):
|
9 |
+
# if username == os.environ["username"] and password == os.environ["password"]:
|
10 |
+
# return True
|
11 |
+
# else:
|
12 |
+
# return False
|
13 |
+
|
14 |
+
### Fetch MongoDB Authentication
|
15 |
+
def check_credentials(email, password):
|
16 |
+
user = userLogin.find_one({'email': email})
|
17 |
+
if not user or user['password'] != password:
|
18 |
+
return False
|
19 |
+
return True
|
20 |
+
|
21 |
+
|
22 |
+
### Authenticate through space
|
23 |
def environ_auth(username, password):
|
24 |
+
auth_ = check_credentials(username, password)
|
25 |
+
if username == True and password == True:
|
26 |
return True
|
27 |
else:
|
28 |
return False
|