Mthrfkr commited on
Commit
6a330d2
Β·
verified Β·
1 Parent(s): d60e5c3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -4
app.py CHANGED
@@ -1,16 +1,32 @@
1
  import os
2
  import requests
3
  import pandas as pd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  import gradio as gr
5
  from tempfile import NamedTemporaryFile
6
 
7
- # β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”
8
- # Config Spotify (Client Credentials)
9
- # β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”
10
  CLIENT_ID = os.getenv("SPOTIFY_CLIENT_IDS", "").split(',')[0]
11
  CLIENT_SECRET = os.getenv("SPOTIFY_CLIENT_SECRETS", "").split(',')[0]
12
 
13
  # FunciΓ³n para obtener token
 
14
  def get_token():
15
  resp = requests.post(
16
  "https://accounts.spotify.com/api/token",
@@ -21,6 +37,7 @@ def get_token():
21
  return resp.json()["access_token"]
22
 
23
  # Extrae el ID de playlist de la URL
 
24
  def extract_pid(url):
25
  return url.strip().rstrip('/').split('/')[-1].split('?')[0]
26
 
@@ -78,7 +95,6 @@ def fetch_playlist_table(url):
78
  return df
79
 
80
  # Interfaz Gradio
81
-
82
  def main(url):
83
  df = fetch_playlist_table(url)
84
  # Guarda CSV temporal
 
1
  import os
2
  import requests
3
  import pandas as pd
4
+
5
+ # β€”β€”β€”β€”β€”β€” PARCHE Pydantic para FastAPI β€”β€”β€”β€”β€”β€”
6
+ import pydantic
7
+ pydantic.Schema = pydantic.Field
8
+
9
+ # β€”β€”β€”β€”β€”β€” PARCHE GRADIO_CLIENT BOOLEANS β€”β€”β€”β€”β€”β€”
10
+ import gradio_client.utils as client_utils
11
+ _orig_get_type = client_utils.get_type
12
+
13
+ def patched_get_type(schema):
14
+ if not isinstance(schema, dict):
15
+ return "Any"
16
+ return _orig_get_type(schema)
17
+
18
+ client_utils.get_type = patched_get_type
19
+ # β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”
20
+
21
  import gradio as gr
22
  from tempfile import NamedTemporaryFile
23
 
24
+ # ConfiguraciΓ³n Spotify (Client Credentials)
 
 
25
  CLIENT_ID = os.getenv("SPOTIFY_CLIENT_IDS", "").split(',')[0]
26
  CLIENT_SECRET = os.getenv("SPOTIFY_CLIENT_SECRETS", "").split(',')[0]
27
 
28
  # FunciΓ³n para obtener token
29
+
30
  def get_token():
31
  resp = requests.post(
32
  "https://accounts.spotify.com/api/token",
 
37
  return resp.json()["access_token"]
38
 
39
  # Extrae el ID de playlist de la URL
40
+
41
  def extract_pid(url):
42
  return url.strip().rstrip('/').split('/')[-1].split('?')[0]
43
 
 
95
  return df
96
 
97
  # Interfaz Gradio
 
98
  def main(url):
99
  df = fetch_playlist_table(url)
100
  # Guarda CSV temporal