Commit 4380067b authored by LSING46's avatar LSING46

main file added

parent e1b793f0
from fastapi import APIRouter, HTTPException
from fastapi.responses import FileResponse
import os
router = APIRouter()
@router.get("/read-file")
async def read_file(file_path: str):
# Define the base directory for public files
base_dir = "/path/to/public/drive"
# Construct the full file path
full_path = os.path.join(base_dir, file_path)
# Check if the file exists
if not os.path.isfile(full_path):
raise HTTPException(status_code=404, detail="File not found")
# Return the file as a response
return FileResponse(full_path)
@router.get("/hello")
async def hello_world():
return {"message": "Hello, World!"}
\ No newline at end of file
from fastapi import FastAPI
from src.api import router
app = FastAPI()
app.include_router(router)
if __name__ == "__main__":
import uvicorn
uvicorn.run(app, host="0.0.0.0", port=8000)
\ No newline at end of file
......@@ -3,4 +3,5 @@ PyPDF2
scikit-learn
transformers
streamlit
fastapi
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment