Pushkar02-n commited on
Commit
e712ea6
·
1 Parent(s): f7f7385

Add API Authorization using APIKeyHeader and initiated UI change to Next JS

Browse files
ui/gradio_app.py CHANGED
@@ -3,6 +3,7 @@ from gradio import themes
3
  import requests
4
  import os
5
  import re
 
6
 
7
  API_URL = os.getenv("API_URL", "http://127.0.0.1:8000")
8
 
@@ -210,7 +211,10 @@ def get_recommendations(query, min_score, genre_filter, anime_type, n_results):
210
  payload["anime_type"] = anime_type
211
 
212
  response = requests.post(
213
- f"{API_URL}/recommend", json=payload, timeout=30)
 
 
 
214
  response.raise_for_status()
215
  result = response.json()
216
 
 
3
  import requests
4
  import os
5
  import re
6
+ from config import settings
7
 
8
  API_URL = os.getenv("API_URL", "http://127.0.0.1:8000")
9
 
 
211
  payload["anime_type"] = anime_type
212
 
213
  response = requests.post(
214
+ f"{API_URL}/recommend",
215
+ json=payload,
216
+ headers={"X-API-Key": settings.frontend_api_key},
217
+ timeout=30)
218
  response.raise_for_status()
219
  result = response.json()
220
 
ui/next.config.mjs ADDED
File without changes
ui/package.json ADDED
File without changes
ui/postcss.config.mjs ADDED
File without changes
ui/tailwind.config.ts ADDED
File without changes
ui/tsconfig.json ADDED
File without changes