Spaces:
Sleeping
Sleeping
Remove frontend dependencies to fix startup error
Browse files
app.py
CHANGED
|
@@ -1,8 +1,6 @@
|
|
| 1 |
from fastapi import FastAPI, HTTPException, Request
|
| 2 |
from fastapi.middleware.cors import CORSMiddleware
|
| 3 |
from fastapi.responses import StreamingResponse, JSONResponse
|
| 4 |
-
from fastapi.staticfiles import StaticFiles
|
| 5 |
-
from fastapi.responses import FileResponse
|
| 6 |
from pydantic import BaseModel
|
| 7 |
import json
|
| 8 |
import logging
|
|
@@ -31,9 +29,7 @@ app.add_middleware(
|
|
| 31 |
expose_headers=["Content-Type", "Cache-Control"]
|
| 32 |
)
|
| 33 |
|
| 34 |
-
#
|
| 35 |
-
frontend_dir = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'frontend')
|
| 36 |
-
app.mount("/static", StaticFiles(directory=frontend_dir), name="static")
|
| 37 |
|
| 38 |
class PromptRequest(BaseModel):
|
| 39 |
model: str
|
|
@@ -41,8 +37,8 @@ class PromptRequest(BaseModel):
|
|
| 41 |
|
| 42 |
@app.get("/")
|
| 43 |
async def read_root():
|
| 44 |
-
"""
|
| 45 |
-
return
|
| 46 |
|
| 47 |
@app.get("/models")
|
| 48 |
async def get_models():
|
|
|
|
| 1 |
from fastapi import FastAPI, HTTPException, Request
|
| 2 |
from fastapi.middleware.cors import CORSMiddleware
|
| 3 |
from fastapi.responses import StreamingResponse, JSONResponse
|
|
|
|
|
|
|
| 4 |
from pydantic import BaseModel
|
| 5 |
import json
|
| 6 |
import logging
|
|
|
|
| 29 |
expose_headers=["Content-Type", "Cache-Control"]
|
| 30 |
)
|
| 31 |
|
| 32 |
+
# API configuration and setup
|
|
|
|
|
|
|
| 33 |
|
| 34 |
class PromptRequest(BaseModel):
|
| 35 |
model: str
|
|
|
|
| 37 |
|
| 38 |
@app.get("/")
|
| 39 |
async def read_root():
|
| 40 |
+
"""API root endpoint."""
|
| 41 |
+
return {"status": "ok", "message": "API is running"}
|
| 42 |
|
| 43 |
@app.get("/models")
|
| 44 |
async def get_models():
|