Spaces:
Sleeping
Sleeping
tesst
Browse files- Dockerfile +4 -1
- app/main.py +5 -2
Dockerfile
CHANGED
|
@@ -14,7 +14,10 @@ RUN pip install --no-cache-dir -r requirements.txt
|
|
| 14 |
# Copy the application
|
| 15 |
COPY app/ ./app/
|
| 16 |
|
| 17 |
-
#
|
|
|
|
|
|
|
|
|
|
| 18 |
RUN ls -la /app/app/static/css && ls -la /app/app/static/js
|
| 19 |
|
| 20 |
# Set environment variables
|
|
|
|
| 14 |
# Copy the application
|
| 15 |
COPY app/ ./app/
|
| 16 |
|
| 17 |
+
# Set proper permissions for static files
|
| 18 |
+
RUN chmod -R 755 /app/app/static
|
| 19 |
+
|
| 20 |
+
# Verify static files are present and permissions
|
| 21 |
RUN ls -la /app/app/static/css && ls -la /app/app/static/js
|
| 22 |
|
| 23 |
# Set environment variables
|
app/main.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
from fastapi import FastAPI, Request
|
| 2 |
from fastapi.templating import Jinja2Templates
|
| 3 |
from fastapi.staticfiles import StaticFiles
|
| 4 |
-
from fastapi.responses import JSONResponse
|
| 5 |
from optimum.neuron import utils
|
| 6 |
import logging
|
| 7 |
import sys
|
|
@@ -97,4 +97,7 @@ async def get_model_info_endpoint(model_id: str):
|
|
| 97 |
@app.get("/static/{path:path}")
|
| 98 |
async def static_files(path: str):
|
| 99 |
logger.info(f"Static file requested: {path}")
|
| 100 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
from fastapi import FastAPI, Request
|
| 2 |
from fastapi.templating import Jinja2Templates
|
| 3 |
from fastapi.staticfiles import StaticFiles
|
| 4 |
+
from fastapi.responses import JSONResponse, FileResponse
|
| 5 |
from optimum.neuron import utils
|
| 6 |
import logging
|
| 7 |
import sys
|
|
|
|
| 97 |
@app.get("/static/{path:path}")
|
| 98 |
async def static_files(path: str):
|
| 99 |
logger.info(f"Static file requested: {path}")
|
| 100 |
+
file_path = os.path.join(static_dir, path)
|
| 101 |
+
if os.path.exists(file_path):
|
| 102 |
+
return FileResponse(file_path)
|
| 103 |
+
return JSONResponse(status_code=404, content={"error": "File not found"})
|