Update app.py
Browse files
app.py
CHANGED
|
@@ -43,24 +43,46 @@ def spotify_auth(client_id, client_secret, code=None):
|
|
| 43 |
return f"Please authorize the app by clicking [here]({auth_url}) and then paste the code below."
|
| 44 |
|
| 45 |
|
| 46 |
-
description ="""
|
| 47 |
-
1. Enter Client ID & Client Secret
|
| 48 |
-
2. Click 'Submit' & follow output instructions
|
| 49 |
-
3. After pasting the code, click 'Submit' again
|
| 50 |
-
"""
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
def gradio_interface():
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
gradio_interface()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
return f"Please authorize the app by clicking [here]({auth_url}) and then paste the code below."
|
| 44 |
|
| 45 |
|
| 46 |
+
# description ="""
|
| 47 |
+
# 1. Enter Client ID & Client Secret
|
| 48 |
+
# 2. Click 'Submit' & follow output instructions
|
| 49 |
+
# 3. After pasting the code, click 'Submit' again
|
| 50 |
+
# """
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
# def gradio_interface():
|
| 54 |
+
# interface = gr.Interface(fn=spotify_auth,
|
| 55 |
+
# inputs=[
|
| 56 |
+
# gr.Textbox(label="Client ID"),
|
| 57 |
+
# gr.Textbox(label="Client Secret"),
|
| 58 |
+
# gr.Textbox(label="Code")
|
| 59 |
+
# ],
|
| 60 |
+
# outputs=["markdown"],
|
| 61 |
+
# description=description,
|
| 62 |
+
# allow_flagging="never",
|
| 63 |
+
# theme="finlaymacklon/boxy_violet"
|
| 64 |
+
# )
|
| 65 |
+
# interface.launch()
|
| 66 |
+
# gradio_interface()
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
with gr.Blocks() as demo:
|
| 70 |
+
gr.Markdown("...")
|
| 71 |
+
|
| 72 |
+
with gr.Tab("Spotify Authentication"):
|
| 73 |
+
with gr.Row():
|
| 74 |
+
client_id = gr.Textbox(label="Client ID")
|
| 75 |
+
client_secret = gr.Textbox(label="Client Secret")
|
| 76 |
+
link_button = gr.Button("Get Link")
|
| 77 |
+
link_result = gr.Markdown()
|
| 78 |
+
|
| 79 |
+
link = gr.Textbox(label="Paste Link")
|
| 80 |
+
auth_button = gr.Button("Authorize")
|
| 81 |
+
auth_result = gr.Textbox()
|
| 82 |
+
|
| 83 |
+
link_button.click(spotify_auth, inputs=[client_id, client_secret], outputs=link_result)
|
| 84 |
+
auth_button.click(spotify_auth, inputs=[client_id, client_secret, link], outputs=auth_result)
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
if __name__ == "__main__":
|
| 88 |
+
demo.launch()
|