Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -17,9 +17,14 @@ SPOTIFY_CLIENT_ID = os.getenv("CLIENT_ID")
|
|
| 17 |
SPOTIFY_CLIENT_SECRET = os.getenv("CLIENT_SECRET")
|
| 18 |
SPOTIFY_REDIRECT_URI = os.getenv("REDIRECT_URL")
|
| 19 |
|
| 20 |
-
#
|
| 21 |
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
|
| 22 |
OPENAI_MODEL = os.getenv("OPENAI_MODEL")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
# Spotify OAuth setup
|
| 25 |
sp_oauth = SpotifyOAuth(
|
|
@@ -60,9 +65,7 @@ def clean_response(response_text):
|
|
| 60 |
cleaned_text = '\n'.join(line.strip() for line in cleaned_text.splitlines() if line.strip())
|
| 61 |
return cleaned_text
|
| 62 |
|
| 63 |
-
|
| 64 |
-
request.headers["X-User-ID"] = str(uuid.uuid4())
|
| 65 |
-
request.headers["X-Channel-ID"] = str(uuid.uuid4())
|
| 66 |
@app.route('/')
|
| 67 |
def index():
|
| 68 |
return render_template('index.html')
|
|
|
|
| 17 |
SPOTIFY_CLIENT_SECRET = os.getenv("CLIENT_SECRET")
|
| 18 |
SPOTIFY_REDIRECT_URI = os.getenv("REDIRECT_URL")
|
| 19 |
|
| 20 |
+
# Shapes API data
|
| 21 |
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
|
| 22 |
OPENAI_MODEL = os.getenv("OPENAI_MODEL")
|
| 23 |
+
#header needs
|
| 24 |
+
def inject_custom_headers(request: httpx.Request) -> None:
|
| 25 |
+
request.headers["X-User-ID"] = str(uuid.uuid4())
|
| 26 |
+
request.headers["X-Channel-ID"] = str(uuid.uuid4())
|
| 27 |
+
|
| 28 |
|
| 29 |
# Spotify OAuth setup
|
| 30 |
sp_oauth = SpotifyOAuth(
|
|
|
|
| 65 |
cleaned_text = '\n'.join(line.strip() for line in cleaned_text.splitlines() if line.strip())
|
| 66 |
return cleaned_text
|
| 67 |
|
| 68 |
+
|
|
|
|
|
|
|
| 69 |
@app.route('/')
|
| 70 |
def index():
|
| 71 |
return render_template('index.html')
|