Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
change
Browse files
app.py
CHANGED
@@ -38,7 +38,7 @@ def get_user(request: Request):
|
|
38 |
def public(request: Request, user: dict = Depends(get_user)):
|
39 |
root_url = gr.route_utils.get_root_url(request, "/", None)
|
40 |
print("root_url", root_url)
|
41 |
-
return RedirectResponse(url='
|
42 |
# if user:
|
43 |
# return RedirectResponse(url=f"{root_url}/gradio")
|
44 |
# else:
|
@@ -70,22 +70,18 @@ async def auth(request: Request):
|
|
70 |
return RedirectResponse(url='/gradio')
|
71 |
|
72 |
with gr.Blocks() as login_demo:
|
73 |
-
btn = gr.Button("Login"
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
# window.location.assign(url);
|
86 |
-
# }
|
87 |
-
# }
|
88 |
-
# """
|
89 |
|
90 |
|
91 |
app = gr.mount_gradio_app(app, login_demo, path="/main")
|
|
|
38 |
def public(request: Request, user: dict = Depends(get_user)):
|
39 |
root_url = gr.route_utils.get_root_url(request, "/", None)
|
40 |
print("root_url", root_url)
|
41 |
+
return RedirectResponse(url=f'{root_url}/main/')
|
42 |
# if user:
|
43 |
# return RedirectResponse(url=f"{root_url}/gradio")
|
44 |
# else:
|
|
|
70 |
return RedirectResponse(url='/gradio')
|
71 |
|
72 |
with gr.Blocks() as login_demo:
|
73 |
+
btn = gr.Button("Login")
|
74 |
+
_js_redirect = """
|
75 |
+
() => {
|
76 |
+
url = '/login' + window.location.search;
|
77 |
+
if ( window !== window.parent ) {
|
78 |
+
window.open(url, '_blank');
|
79 |
+
} else {
|
80 |
+
window.location.assign(url);
|
81 |
+
}
|
82 |
+
}
|
83 |
+
"""
|
84 |
+
btn.click(None, js=_js_redirect)
|
|
|
|
|
|
|
|
|
85 |
|
86 |
|
87 |
app = gr.mount_gradio_app(app, login_demo, path="/main")
|