Spaces:
Sleeping
Sleeping
Dadflip commited on
Commit Β·
f88f1b2
1
Parent(s): 6eec890
fixes
Browse files- Dockerfile +2 -1
- README.md +12 -7
- app.py +12 -0
Dockerfile
CHANGED
|
@@ -4,7 +4,7 @@ COPY frontend/package*.json ./
|
|
| 4 |
RUN npm ci
|
| 5 |
COPY frontend/ ./
|
| 6 |
RUN npm run build
|
| 7 |
-
# outDir
|
| 8 |
|
| 9 |
FROM python:3.11-slim
|
| 10 |
WORKDIR /app
|
|
@@ -13,6 +13,7 @@ COPY requirements.txt .
|
|
| 13 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 14 |
|
| 15 |
COPY . .
|
|
|
|
| 16 |
COPY --from=frontend-builder /static ./static
|
| 17 |
|
| 18 |
EXPOSE 7860
|
|
|
|
| 4 |
RUN npm ci
|
| 5 |
COPY frontend/ ./
|
| 6 |
RUN npm run build
|
| 7 |
+
# outDir '../static' relative to /build β /static
|
| 8 |
|
| 9 |
FROM python:3.11-slim
|
| 10 |
WORKDIR /app
|
|
|
|
| 13 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 14 |
|
| 15 |
COPY . .
|
| 16 |
+
# Copy built frontend from builder stage
|
| 17 |
COPY --from=frontend-builder /static ./static
|
| 18 |
|
| 19 |
EXPOSE 7860
|
README.md
CHANGED
|
@@ -1,12 +1,17 @@
|
|
| 1 |
---
|
| 2 |
-
title: Flippa
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
colorTo: indigo
|
| 6 |
-
sdk:
|
| 7 |
-
|
| 8 |
-
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
---
|
| 11 |
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: Flippa AI
|
| 3 |
+
emoji: π€
|
| 4 |
+
colorFrom: blue
|
| 5 |
colorTo: indigo
|
| 6 |
+
sdk: docker
|
| 7 |
+
app_port: 7860
|
|
|
|
| 8 |
pinned: false
|
| 9 |
---
|
| 10 |
|
| 11 |
+
# Flippa AI
|
| 12 |
+
|
| 13 |
+
Assistant IA génératif multi-modèles HuggingFace.
|
| 14 |
+
|
| 15 |
+
**Modules disponibles :** Chat, Analyse de sentiment, Résumé, Traduction, Synthèse vocale, Classification d'image.
|
| 16 |
+
|
| 17 |
+
**Stack :** FastAPI Β· Vite Β· React Β· shadcn/ui Β· HuggingFace Transformers
|
app.py
CHANGED
|
@@ -266,11 +266,23 @@ async def run_module_upload(
|
|
| 266 |
# ββ SPA βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 267 |
|
| 268 |
static_dir = os.path.join(os.path.dirname(__file__), "static")
|
|
|
|
| 269 |
if os.path.isdir(static_dir):
|
|
|
|
| 270 |
assets_dir = os.path.join(static_dir, "assets")
|
| 271 |
if os.path.isdir(assets_dir):
|
| 272 |
app.mount("/assets", StaticFiles(directory=assets_dir), name="assets")
|
| 273 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 274 |
@app.get("/{full_path:path}", include_in_schema=False)
|
| 275 |
async def spa(full_path: str):
|
| 276 |
return FileResponse(os.path.join(static_dir, "index.html"))
|
|
|
|
| 266 |
# ββ SPA βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 267 |
|
| 268 |
static_dir = os.path.join(os.path.dirname(__file__), "static")
|
| 269 |
+
|
| 270 |
if os.path.isdir(static_dir):
|
| 271 |
+
# Mount assets explicitly first (takes priority)
|
| 272 |
assets_dir = os.path.join(static_dir, "assets")
|
| 273 |
if os.path.isdir(assets_dir):
|
| 274 |
app.mount("/assets", StaticFiles(directory=assets_dir), name="assets")
|
| 275 |
|
| 276 |
+
# Serve root-level static files (favicon, iconsβ¦)
|
| 277 |
+
@app.get("/favicon.svg", include_in_schema=False)
|
| 278 |
+
async def favicon():
|
| 279 |
+
return FileResponse(os.path.join(static_dir, "favicon.svg"))
|
| 280 |
+
|
| 281 |
+
@app.get("/icons.svg", include_in_schema=False)
|
| 282 |
+
async def icons():
|
| 283 |
+
return FileResponse(os.path.join(static_dir, "icons.svg"))
|
| 284 |
+
|
| 285 |
+
# SPA fallback β must be last
|
| 286 |
@app.get("/{full_path:path}", include_in_schema=False)
|
| 287 |
async def spa(full_path: str):
|
| 288 |
return FileResponse(os.path.join(static_dir, "index.html"))
|