06eb3c57ab
- Chart.js - pdf, csv 파일 업로드 후 데이터 정제하여 llm으로 처리 후 결과 도출 - sqlite로 데이터 저장 - ORM - SQLAlchemy
25 lines
852 B
Python
25 lines
852 B
Python
from fastapi import APIRouter, Request, UploadFile
|
|
from backend.schemas.card_schema import AnalysisRequest
|
|
from backend.services.card_service import upload_csv, card_history, get_dashboard, card_analysis
|
|
from fastapi.templating import Jinja2Templates
|
|
|
|
router = APIRouter(prefix="/api/card")
|
|
templates = Jinja2Templates(directory="backend/templates")
|
|
|
|
@router.post("/upload")
|
|
async def upload_file(file: UploadFile):
|
|
return await upload_csv(file)
|
|
|
|
@router.get("/history")
|
|
async def history(request : Request):
|
|
card_infos = card_history()
|
|
|
|
return templates.TemplateResponse(request, name = "history.html", context = {"history": card_infos})
|
|
|
|
@router.get("/dashboard")
|
|
async def dashboard():
|
|
return get_dashboard()
|
|
|
|
@router.post("/analysis")
|
|
async def sql_llm_analysis(request : AnalysisRequest):
|
|
return card_analysis(request.question) |