Spaces:
Running
Running
from fastapi import FastAPI, Request, Form | |
from fastapi.responses import HTMLResponse | |
from fastapi.templating import Jinja2Templates | |
from career_data import get_career_recommendations | |
app = FastAPI() | |
# Load templates from the templates directory | |
templates = Jinja2Templates(directory="templates") | |
async def read_root(request: Request): | |
return templates.TemplateResponse("index.html", {"request": request}) | |
async def recommend_career(request: Request, skills: str = Form(...), interests: str = Form(...)): | |
recommendations = get_career_recommendations(skills, interests) | |
return templates.TemplateResponse("index.html", { | |
"request": request, | |
"recommendations": recommendations, | |
"skills": skills, | |
"interests": interests | |
}) | |