Spaces:
Running
on
Zero
Running
on
Zero
Joffrey Thomas
commited on
Commit
·
54ea10b
1
Parent(s):
a3407a6
logout
Browse files
app.py
CHANGED
|
@@ -10,7 +10,7 @@ import spaces
|
|
| 10 |
import requests
|
| 11 |
from dotenv import load_dotenv
|
| 12 |
import gradio as gr
|
| 13 |
-
from gradio.components import LoginButton
|
| 14 |
|
| 15 |
import data_manager
|
| 16 |
|
|
@@ -707,6 +707,7 @@ with gr.Blocks(css=APP_CSS, title="LLM GeoGuessr") as demo:
|
|
| 707 |
login_button = LoginButton(visible=True)
|
| 708 |
|
| 709 |
logged_in_md = gr.Markdown(visible=False)
|
|
|
|
| 710 |
|
| 711 |
with gr.Group(visible=False, elem_id="lobby_group") as lobby_group:
|
| 712 |
start_btn = gr.Button("Start Game", variant="primary", elem_id="start_btn")
|
|
@@ -735,6 +736,7 @@ with gr.Blocks(css=APP_CSS, title="LLM GeoGuessr") as demo:
|
|
| 735 |
gr.update(visible=True),
|
| 736 |
gr.update(visible=False),
|
| 737 |
gr.update(visible=False),
|
|
|
|
| 738 |
gr.update(),
|
| 739 |
gr.update(visible=False),
|
| 740 |
)
|
|
@@ -752,6 +754,7 @@ with gr.Blocks(css=APP_CSS, title="LLM GeoGuessr") as demo:
|
|
| 752 |
gr.update(visible=True),
|
| 753 |
gr.update(visible=False),
|
| 754 |
gr.update(visible=False),
|
|
|
|
| 755 |
gr.update(),
|
| 756 |
gr.update(visible=False),
|
| 757 |
)
|
|
@@ -764,6 +767,7 @@ with gr.Blocks(css=APP_CSS, title="LLM GeoGuessr") as demo:
|
|
| 764 |
gr.update(visible=False),
|
| 765 |
gr.update(visible=True, value=welcome_message),
|
| 766 |
gr.update(visible=True),
|
|
|
|
| 767 |
]
|
| 768 |
|
| 769 |
if has_played:
|
|
@@ -789,6 +793,7 @@ with gr.Blocks(css=APP_CSS, title="LLM GeoGuessr") as demo:
|
|
| 789 |
login_prompt_md,
|
| 790 |
login_button,
|
| 791 |
logged_in_md,
|
|
|
|
| 792 |
lobby_group,
|
| 793 |
start_btn,
|
| 794 |
limit_msg,
|
|
@@ -803,6 +808,22 @@ with gr.Blocks(css=APP_CSS, title="LLM GeoGuessr") as demo:
|
|
| 803 |
login_prompt_md,
|
| 804 |
login_button,
|
| 805 |
logged_in_md,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 806 |
lobby_group,
|
| 807 |
start_btn,
|
| 808 |
limit_msg,
|
|
|
|
| 10 |
import requests
|
| 11 |
from dotenv import load_dotenv
|
| 12 |
import gradio as gr
|
| 13 |
+
from gradio.components import LoginButton, LogoutButton
|
| 14 |
|
| 15 |
import data_manager
|
| 16 |
|
|
|
|
| 707 |
login_button = LoginButton(visible=True)
|
| 708 |
|
| 709 |
logged_in_md = gr.Markdown(visible=False)
|
| 710 |
+
logout_button = LogoutButton(visible=False)
|
| 711 |
|
| 712 |
with gr.Group(visible=False, elem_id="lobby_group") as lobby_group:
|
| 713 |
start_btn = gr.Button("Start Game", variant="primary", elem_id="start_btn")
|
|
|
|
| 736 |
gr.update(visible=True),
|
| 737 |
gr.update(visible=False),
|
| 738 |
gr.update(visible=False),
|
| 739 |
+
gr.update(visible=False),
|
| 740 |
gr.update(),
|
| 741 |
gr.update(visible=False),
|
| 742 |
)
|
|
|
|
| 754 |
gr.update(visible=True),
|
| 755 |
gr.update(visible=False),
|
| 756 |
gr.update(visible=False),
|
| 757 |
+
gr.update(visible=False),
|
| 758 |
gr.update(),
|
| 759 |
gr.update(visible=False),
|
| 760 |
)
|
|
|
|
| 767 |
gr.update(visible=False),
|
| 768 |
gr.update(visible=True, value=welcome_message),
|
| 769 |
gr.update(visible=True),
|
| 770 |
+
gr.update(visible=True),
|
| 771 |
]
|
| 772 |
|
| 773 |
if has_played:
|
|
|
|
| 793 |
login_prompt_md,
|
| 794 |
login_button,
|
| 795 |
logged_in_md,
|
| 796 |
+
logout_button,
|
| 797 |
lobby_group,
|
| 798 |
start_btn,
|
| 799 |
limit_msg,
|
|
|
|
| 808 |
login_prompt_md,
|
| 809 |
login_button,
|
| 810 |
logged_in_md,
|
| 811 |
+
logout_button,
|
| 812 |
+
lobby_group,
|
| 813 |
+
start_btn,
|
| 814 |
+
limit_msg,
|
| 815 |
+
],
|
| 816 |
+
)
|
| 817 |
+
|
| 818 |
+
# Handle logout
|
| 819 |
+
logout_button.click(
|
| 820 |
+
on_login,
|
| 821 |
+
outputs=[
|
| 822 |
+
user_profile,
|
| 823 |
+
login_prompt_md,
|
| 824 |
+
login_button,
|
| 825 |
+
logged_in_md,
|
| 826 |
+
logout_button,
|
| 827 |
lobby_group,
|
| 828 |
start_btn,
|
| 829 |
limit_msg,
|