Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -30,6 +30,7 @@ with gr.Blocks(title="RNG Spotify Playlist Shuffler") as demo:
|
|
30 |
|
31 |
with gr.Column():
|
32 |
login_button = gr.Button("π Step 1: Login to Spotify")
|
|
|
33 |
code_box = gr.Textbox(label="Step 2: Paste authorization code", placeholder="...?code=ABC123", visible=False)
|
34 |
authorize_button = gr.Button("β
Step 3: Complete Authorization", visible=False)
|
35 |
login_status = gr.Markdown(visible=False)
|
@@ -37,9 +38,6 @@ with gr.Blocks(title="RNG Spotify Playlist Shuffler") as demo:
|
|
37 |
shuffle_button = gr.Button("π Step 5: Shuffle and Play", visible=False)
|
38 |
result_box = gr.Markdown(visible=False)
|
39 |
|
40 |
-
# Open Spotify login in a new tab
|
41 |
-
login_button.click(js=f"() => window.open('{auth_url}', '_blank')")
|
42 |
-
|
43 |
def check_login(code):
|
44 |
global sp, user_playlists
|
45 |
if not code:
|
@@ -97,11 +95,11 @@ with gr.Blocks(title="RNG Spotify Playlist Shuffler") as demo:
|
|
97 |
)
|
98 |
|
99 |
def show_authorize_inputs():
|
100 |
-
return gr.update(visible=True), gr.update(visible=True)
|
101 |
|
102 |
login_button.click(
|
103 |
fn=show_authorize_inputs,
|
104 |
-
outputs=[code_box, authorize_button],
|
105 |
show_progress=False
|
106 |
)
|
107 |
|
|
|
30 |
|
31 |
with gr.Column():
|
32 |
login_button = gr.Button("π Step 1: Login to Spotify")
|
33 |
+
login_link = gr.Markdown(f"[Click here to login to Spotify]({auth_url})", visible=False)
|
34 |
code_box = gr.Textbox(label="Step 2: Paste authorization code", placeholder="...?code=ABC123", visible=False)
|
35 |
authorize_button = gr.Button("β
Step 3: Complete Authorization", visible=False)
|
36 |
login_status = gr.Markdown(visible=False)
|
|
|
38 |
shuffle_button = gr.Button("π Step 5: Shuffle and Play", visible=False)
|
39 |
result_box = gr.Markdown(visible=False)
|
40 |
|
|
|
|
|
|
|
41 |
def check_login(code):
|
42 |
global sp, user_playlists
|
43 |
if not code:
|
|
|
95 |
)
|
96 |
|
97 |
def show_authorize_inputs():
|
98 |
+
return gr.update(visible=True), gr.update(visible=True), gr.update(visible=True)
|
99 |
|
100 |
login_button.click(
|
101 |
fn=show_authorize_inputs,
|
102 |
+
outputs=[login_link, code_box, authorize_button],
|
103 |
show_progress=False
|
104 |
)
|
105 |
|