Mthrfkr commited on
Commit
53a40b3
verified
1 Parent(s): 11b02ef

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -148,7 +148,7 @@ def obtener_record_label_spotify(album_id, token):
148
  return album_info.get('label', 'No disponible')
149
 
150
  # Funci贸n principal de la interfaz
151
- def interface(query, num_spotify_playlists=50):
152
  # Obtener tokens y claves
153
  token_spotify = obtener_token(client_ids[current_api_index], client_secrets[current_api_index])
154
  playlists_spotify = buscar_playlists_spotify(token_spotify, query, num_spotify_playlists)
@@ -165,6 +165,7 @@ def interface(query, num_spotify_playlists=50):
165
  df.sort_values(by=['popularity'], ascending=False, inplace=True)
166
 
167
  with NamedTemporaryFile(delete=False, suffix='.xlsx') as tmpfile:
 
168
  df.to_excel(tmpfile.name, index=False)
169
  return df, tmpfile.name # Devuelve el DataFrame y el enlace al archivo Excel
170
 
@@ -172,8 +173,9 @@ def interface(query, num_spotify_playlists=50):
172
  iface = gr.Interface(
173
  fn=interface,
174
  inputs=[
175
- gr.Textbox(label="Search Query"),
176
- gr.Number(label="Number of Spotify Playlists", value=50, minimum=1, maximum=1000)
 
177
  ],
178
  outputs=[gr.Dataframe(), gr.File(label="Download Excel")],
179
  title="Spotify Playlist Fetcher",
 
148
  return album_info.get('label', 'No disponible')
149
 
150
  # Funci贸n principal de la interfaz
151
+ def interface(project_name, query, num_spotify_playlists=50):
152
  # Obtener tokens y claves
153
  token_spotify = obtener_token(client_ids[current_api_index], client_secrets[current_api_index])
154
  playlists_spotify = buscar_playlists_spotify(token_spotify, query, num_spotify_playlists)
 
165
  df.sort_values(by=['popularity'], ascending=False, inplace=True)
166
 
167
  with NamedTemporaryFile(delete=False, suffix='.xlsx') as tmpfile:
168
+ file_name = f"{project_name}.xlsx"
169
  df.to_excel(tmpfile.name, index=False)
170
  return df, tmpfile.name # Devuelve el DataFrame y el enlace al archivo Excel
171
 
 
173
  iface = gr.Interface(
174
  fn=interface,
175
  inputs=[
176
+ gr.Textbox(label="Nombre del Proyecto"),
177
+ gr.Textbox(label="Keywords - Palabras Clave para tu b煤squeda"),
178
+ gr.Number(label="Numero de Playlists que vamos a buscar con estas Keywords", value=50, minimum=1, maximum=1000)
179
  ],
180
  outputs=[gr.Dataframe(), gr.File(label="Download Excel")],
181
  title="Spotify Playlist Fetcher",