Commit
·
275c820
1
Parent(s):
bc22fc4
Minor bug fix to connection parameter function
Browse files- app.py +2 -2
- tools/helper_functions.py +3 -0
app.py
CHANGED
@@ -123,12 +123,12 @@ with app:
|
|
123 |
app.load(get_connection_params, inputs=None, outputs=[session_hash_state, s3_output_folder_state])
|
124 |
|
125 |
# Launch the Gradio app
|
126 |
-
COGNITO_AUTH = get_or_create_env_var('COGNITO_AUTH', '
|
127 |
print(f'The value of COGNITO_AUTH is {COGNITO_AUTH}')
|
128 |
|
129 |
if __name__ == "__main__":
|
130 |
|
131 |
-
if os.environ['COGNITO_AUTH'] == "
|
132 |
app.queue().launch(show_error=True, auth=authenticate_user)
|
133 |
else:
|
134 |
app.queue().launch(show_error=True, inbrowser=True)
|
|
|
123 |
app.load(get_connection_params, inputs=None, outputs=[session_hash_state, s3_output_folder_state])
|
124 |
|
125 |
# Launch the Gradio app
|
126 |
+
COGNITO_AUTH = get_or_create_env_var('COGNITO_AUTH', '1')
|
127 |
print(f'The value of COGNITO_AUTH is {COGNITO_AUTH}')
|
128 |
|
129 |
if __name__ == "__main__":
|
130 |
|
131 |
+
if os.environ['COGNITO_AUTH'] == "0":
|
132 |
app.queue().launch(show_error=True, auth=authenticate_user)
|
133 |
else:
|
134 |
app.queue().launch(show_error=True, inbrowser=True)
|
tools/helper_functions.py
CHANGED
@@ -111,6 +111,8 @@ def add_folder_to_path(folder_path: str):
|
|
111 |
print(f"Folder not found at {folder_path} - not added to PATH")
|
112 |
|
113 |
async def get_connection_params(request: gr.Request):
|
|
|
|
|
114 |
if request:
|
115 |
#print("request user:", request.username)
|
116 |
|
@@ -148,6 +150,7 @@ async def get_connection_params(request: gr.Request):
|
|
148 |
|
149 |
if request.username:
|
150 |
out_session_hash = request.username
|
|
|
151 |
print("Request username found:", out_session_hash)
|
152 |
|
153 |
elif 'x-cognito-id' in request.headers:
|
|
|
111 |
print(f"Folder not found at {folder_path} - not added to PATH")
|
112 |
|
113 |
async def get_connection_params(request: gr.Request):
|
114 |
+
base_folder = ""
|
115 |
+
|
116 |
if request:
|
117 |
#print("request user:", request.username)
|
118 |
|
|
|
150 |
|
151 |
if request.username:
|
152 |
out_session_hash = request.username
|
153 |
+
base_folder = "user-files/"
|
154 |
print("Request username found:", out_session_hash)
|
155 |
|
156 |
elif 'x-cognito-id' in request.headers:
|