Spaces:
Paused
Paused
updated app.py
Browse files
app.py
CHANGED
|
@@ -47,7 +47,10 @@ def start_http_server():
|
|
| 47 |
def login():
|
| 48 |
auth_url = f"{AUTHORITY_URL}/authorize?client_id={CLIENT_ID}&response_type=code&redirect_uri={REDIRECT_URI}&scope={SCOPE}"
|
| 49 |
webbrowser.open(auth_url)
|
| 50 |
-
|
|
|
|
|
|
|
|
|
|
| 51 |
@spaces.GPU(duration=60)
|
| 52 |
def gradio_interface():
|
| 53 |
with gr.Blocks() as demo:
|
|
@@ -55,11 +58,6 @@ def gradio_interface():
|
|
| 55 |
btn_login = gr.Button("Login with Microsoft")
|
| 56 |
output = gr.Textbox(label="Status")
|
| 57 |
|
| 58 |
-
def check_login():
|
| 59 |
-
if access_token:
|
| 60 |
-
return "You are logged in!"
|
| 61 |
-
return "You are not logged in."
|
| 62 |
-
|
| 63 |
btn_login.click(lambda: (login(), check_login()), None, output)
|
| 64 |
|
| 65 |
return demo
|
|
@@ -70,4 +68,4 @@ if __name__ == "__main__":
|
|
| 70 |
|
| 71 |
# Launch Gradio app
|
| 72 |
demo = gradio_interface()
|
| 73 |
-
demo.launch()
|
|
|
|
| 47 |
def login():
|
| 48 |
auth_url = f"{AUTHORITY_URL}/authorize?client_id={CLIENT_ID}&response_type=code&redirect_uri={REDIRECT_URI}&scope={SCOPE}"
|
| 49 |
webbrowser.open(auth_url)
|
| 50 |
+
|
| 51 |
+
def check_login():
|
| 52 |
+
return "You are logged in!" if access_token else "You are not logged in."
|
| 53 |
+
|
| 54 |
@spaces.GPU(duration=60)
|
| 55 |
def gradio_interface():
|
| 56 |
with gr.Blocks() as demo:
|
|
|
|
| 58 |
btn_login = gr.Button("Login with Microsoft")
|
| 59 |
output = gr.Textbox(label="Status")
|
| 60 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
btn_login.click(lambda: (login(), check_login()), None, output)
|
| 62 |
|
| 63 |
return demo
|
|
|
|
| 68 |
|
| 69 |
# Launch Gradio app
|
| 70 |
demo = gradio_interface()
|
| 71 |
+
demo.launch()
|