Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -25,7 +25,6 @@ CLIENT_ID = os.getenv("SPOTIFY_CLIENT_IDS", "").split(',')[0]
|
|
| 25 |
CLIENT_SECRET = os.getenv("SPOTIFY_CLIENT_SECRETS", "").split(',')[0]
|
| 26 |
|
| 27 |
# Funci贸n para obtener token
|
| 28 |
-
|
| 29 |
def get_token():
|
| 30 |
resp = requests.post(
|
| 31 |
"https://accounts.spotify.com/api/token",
|
|
@@ -51,7 +50,6 @@ def get_artist_genres(aid, headers):
|
|
| 51 |
return genres
|
| 52 |
|
| 53 |
# Fetch y devuelve DataFrame de toda la playlist
|
| 54 |
-
|
| 55 |
def fetch_playlist_table(url):
|
| 56 |
if not CLIENT_ID or not CLIENT_SECRET:
|
| 57 |
return pd.DataFrame([{'Error': 'Faltan credenciales'}])
|
|
@@ -94,14 +92,13 @@ def fetch_playlist_table(url):
|
|
| 94 |
return df
|
| 95 |
|
| 96 |
# Funci贸n principal: retorna DataFrame para mostrar en tabla
|
| 97 |
-
|
| 98 |
def main(url):
|
| 99 |
return fetch_playlist_table(url)
|
| 100 |
|
| 101 |
# Interfaz Gradio: s贸lo DataFrame
|
| 102 |
iface = gr.Interface(
|
| 103 |
fn=main,
|
| 104 |
-
inputs=gr.Textbox(label="URL de playlist", placeholder="https://open.spotify.com/playlist/...")
|
| 105 |
outputs=gr.Dataframe(headers=['Artist','Title','ISRC','URL','URI','Genres'], label="Tabla de Playlist Spotify"),
|
| 106 |
title="馃幍 Tabla de Playlist Spotify",
|
| 107 |
description="Trae Artist, Title, ISRC, URL, URI y G茅neros de cada track"
|
|
|
|
| 25 |
CLIENT_SECRET = os.getenv("SPOTIFY_CLIENT_SECRETS", "").split(',')[0]
|
| 26 |
|
| 27 |
# Funci贸n para obtener token
|
|
|
|
| 28 |
def get_token():
|
| 29 |
resp = requests.post(
|
| 30 |
"https://accounts.spotify.com/api/token",
|
|
|
|
| 50 |
return genres
|
| 51 |
|
| 52 |
# Fetch y devuelve DataFrame de toda la playlist
|
|
|
|
| 53 |
def fetch_playlist_table(url):
|
| 54 |
if not CLIENT_ID or not CLIENT_SECRET:
|
| 55 |
return pd.DataFrame([{'Error': 'Faltan credenciales'}])
|
|
|
|
| 92 |
return df
|
| 93 |
|
| 94 |
# Funci贸n principal: retorna DataFrame para mostrar en tabla
|
|
|
|
| 95 |
def main(url):
|
| 96 |
return fetch_playlist_table(url)
|
| 97 |
|
| 98 |
# Interfaz Gradio: s贸lo DataFrame
|
| 99 |
iface = gr.Interface(
|
| 100 |
fn=main,
|
| 101 |
+
inputs=gr.Textbox(label="URL de playlist", placeholder="https://open.spotify.com/playlist/..."),
|
| 102 |
outputs=gr.Dataframe(headers=['Artist','Title','ISRC','URL','URI','Genres'], label="Tabla de Playlist Spotify"),
|
| 103 |
title="馃幍 Tabla de Playlist Spotify",
|
| 104 |
description="Trae Artist, Title, ISRC, URL, URI y G茅neros de cada track"
|