atz21 commited on
Commit
214678b
·
verified ·
1 Parent(s): b8e8d08

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -317,19 +317,19 @@ def ask_gemini_for_mapping_for_page(model, image_path, grading_json, expected_id
317
  if expected_ids:
318
  ids_block = "{\n" + "\n".join(expected_ids) + "\n}"
319
  prompt = f"""
320
- You are an exam marker. Your role is to identify where each question begins on the page.
 
 
321
  The page is divided into a {rows} x {cols} grid. Each cell has a RUNNING NUMBER label (1..{rows*cols}).
322
  For each question in the grading JSON, return the cell NUMBER where the FIRST STEP of that question begins.
323
- IMPORTANT: Only spot and return cell numbers for the following question IDs (one per line):
324
  {ids_block}
325
  If you see a sub-question (e.g., ii) above a main question (e.g., Q4), infer it belongs to the previous question (e.g., Q3.ii).
326
  - Do not place marks inside another question's answer area.
327
- - Each question should have unique cell number
328
- - Each question to be placed on diff rows
329
- - If the page has only 1 written no other question around to find context whether it is question or subquestion always assume it to be Q1
330
- - Prefer placing the marks in a BLANK cell immediately to the RIGHT of the answer step. If no blank cell is available to the right, then place in a blank cell to the LEFT.
331
  - Never place marks above or below the answer.
332
- - If a question starts on a previous page, you may omit it for this page.
333
  Return JSON only, like:
334
  [{{"question": "1.a", "cell_number": 15}}, ...]
335
  Grading JSON:
 
317
  if expected_ids:
318
  ids_block = "{\n" + "\n".join(expected_ids) + "\n}"
319
  prompt = f"""
320
+ You are an exam marker. Your task is to locate a blank cell adjacent to the answer step and place the marks there:
321
+ Primary preference: Use the blank cell immediately to the right of the answer step.
322
+ Fallback: If no blank cell is available on the right, use the blank cell immediately to the left..
323
  The page is divided into a {rows} x {cols} grid. Each cell has a RUNNING NUMBER label (1..{rows*cols}).
324
  For each question in the grading JSON, return the cell NUMBER where the FIRST STEP of that question begins.
325
+ IMPORTANT: For your help i have provided u questions that u can expect in the image :
326
  {ids_block}
327
  If you see a sub-question (e.g., ii) above a main question (e.g., Q4), infer it belongs to the previous question (e.g., Q3.ii).
328
  - Do not place marks inside another question's answer area.
329
+ - Each question should have unique cell number
330
+ - If a question serial number is visible in the answer image, you must mandatorily identify the corresponding question using the grading JSON.
 
 
331
  - Never place marks above or below the answer.
332
+ - Only if there is no serial number u may omit to select cell number for mark placement
333
  Return JSON only, like:
334
  [{{"question": "1.a", "cell_number": 15}}, ...]
335
  Grading JSON: