Spaces:
Sleeping
Sleeping
Commit ·
b3a2905
1
Parent(s): a1d42fd
Docker image Setup
Browse files
backend/api/__pycache__/views.cpython-313.pyc
CHANGED
|
Binary files a/backend/api/__pycache__/views.cpython-313.pyc and b/backend/api/__pycache__/views.cpython-313.pyc differ
|
|
|
backend/api/views.py
CHANGED
|
@@ -139,7 +139,9 @@ class PredictView(APIView):
|
|
| 139 |
client = CLIENT_CACHE[space_id]
|
| 140 |
else:
|
| 141 |
log_backend_message(f"PredictView: Initializing new Gradio client for space: {space_id}")
|
| 142 |
-
|
|
|
|
|
|
|
| 143 |
CLIENT_CACHE[space_id] = client
|
| 144 |
log_backend_message(f"PredictView: New client for {space_id} cached.")
|
| 145 |
|
|
|
|
| 139 |
client = CLIENT_CACHE[space_id]
|
| 140 |
else:
|
| 141 |
log_backend_message(f"PredictView: Initializing new Gradio client for space: {space_id}")
|
| 142 |
+
# Use HF_TOKEN from environment if available for gated/private spaces
|
| 143 |
+
hf_token = os.getenv("HF_TOKEN")
|
| 144 |
+
client = Client(space_id, hf_token=hf_token, httpx_kwargs={"timeout": 1000}, verbose=True)
|
| 145 |
CLIENT_CACHE[space_id] = client
|
| 146 |
log_backend_message(f"PredictView: New client for {space_id} cached.")
|
| 147 |
|
backend/core/__pycache__/urls.cpython-313.pyc
CHANGED
|
Binary files a/backend/core/__pycache__/urls.cpython-313.pyc and b/backend/core/__pycache__/urls.cpython-313.pyc differ
|
|
|
backend/core/urls.py
CHANGED
|
@@ -19,10 +19,14 @@ from django.urls import path, include, re_path
|
|
| 19 |
from django.conf import settings
|
| 20 |
from django.conf.urls.static import static
|
| 21 |
from django.views.generic import TemplateView
|
|
|
|
| 22 |
|
| 23 |
urlpatterns = [
|
| 24 |
path('super-secret-admin-path/', admin.site.urls),
|
| 25 |
path('api/', include('api.urls')),
|
|
|
|
|
|
|
|
|
|
| 26 |
# Catch-all to serve React SPA
|
| 27 |
re_path(r'^(?!api/).*$', TemplateView.as_view(template_name='index.html')),
|
| 28 |
]
|
|
|
|
| 19 |
from django.conf import settings
|
| 20 |
from django.conf.urls.static import static
|
| 21 |
from django.views.generic import TemplateView
|
| 22 |
+
from django.views.static import serve as static_serve
|
| 23 |
|
| 24 |
urlpatterns = [
|
| 25 |
path('super-secret-admin-path/', admin.site.urls),
|
| 26 |
path('api/', include('api.urls')),
|
| 27 |
+
# Serve CRA root-level build assets
|
| 28 |
+
re_path(r'^(?P<path>(favicon\\.ico|manifest\\.json|logo\\.jpeg))$',
|
| 29 |
+
lambda request, path: static_serve(request, path, document_root=str(settings.BASE_DIR.parent / 'frontend' / 'build'))),
|
| 30 |
# Catch-all to serve React SPA
|
| 31 |
re_path(r'^(?!api/).*$', TemplateView.as_view(template_name='index.html')),
|
| 32 |
]
|