mominah commited on
Commit
78c2297
·
verified ·
1 Parent(s): 1c2f48f

Update check.py

Browse files
Files changed (1) hide show
  1. check.py +4 -4
check.py CHANGED
@@ -21,7 +21,7 @@ from google.genai import types
21
  # Initialize the GenAI client with the API key.
22
  client = genai.Client(api_key=GENAI_API_KEY)
23
 
24
- app = FastAPI(title="Student Result Card API (Paper K only)")
25
 
26
  # Use system temporary directory to store the results file.
27
  TEMP_FOLDER = tempfile.gettempdir()
@@ -165,7 +165,7 @@ def load_answer_key(pdf_bytes: bytes) -> dict:
165
  # FastAPI Endpoints
166
  ##############################################################
167
 
168
- @app.post("/process")
169
  async def process_pdfs(
170
  original_pdf: UploadFile = File(..., description="PDF with all student answer sheets (one page per student)"),
171
  paper_k_pdf: UploadFile = File(..., description="Answer key PDF for Paper K")
@@ -227,7 +227,7 @@ async def process_pdfs(
227
  raise HTTPException(status_code=500, detail=str(e))
228
 
229
 
230
- @app.get("/download")
231
  async def download_results():
232
  """
233
  Returns the result JSON file stored in the temporary folder.
@@ -241,7 +241,7 @@ async def download_results():
241
  )
242
 
243
 
244
- @app.get("/")
245
  async def root():
246
  return {
247
  "message": "Welcome to the Student Result Card API (Paper K only).",
 
21
  # Initialize the GenAI client with the API key.
22
  client = genai.Client(api_key=GENAI_API_KEY)
23
 
24
+ router = APIRouter(prefix="/check", tags=["check"])
25
 
26
  # Use system temporary directory to store the results file.
27
  TEMP_FOLDER = tempfile.gettempdir()
 
165
  # FastAPI Endpoints
166
  ##############################################################
167
 
168
+ @@router.post("/process")
169
  async def process_pdfs(
170
  original_pdf: UploadFile = File(..., description="PDF with all student answer sheets (one page per student)"),
171
  paper_k_pdf: UploadFile = File(..., description="Answer key PDF for Paper K")
 
227
  raise HTTPException(status_code=500, detail=str(e))
228
 
229
 
230
+ @@router.get("/download")
231
  async def download_results():
232
  """
233
  Returns the result JSON file stored in the temporary folder.
 
241
  )
242
 
243
 
244
+ @@router.get("/")
245
  async def root():
246
  return {
247
  "message": "Welcome to the Student Result Card API (Paper K only).",