atz21 commited on
Commit
d1f4b8e
·
verified ·
1 Parent(s): 33bf00f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -4
app.py CHANGED
@@ -9,10 +9,26 @@ from reportlab.lib.pagesizes import A4
9
  genai.configure(api_key=os.getenv("GEMINI_API_KEY"))
10
 
11
  # ---------- PROMPTS ----------
12
- TRANSCRIPTION_PROMPT = """ Transcribe the PDF into a clean, question-wise format. While doing so, ensure the following:
13
- Exclude any text that has been cut, striked, or crossed out (since these may represent student mistakes).
14
- Clearly distinguish between a "step cut" and when variables cancel out during a step.
15
- Present the transcription neatly without including unnecessary markings. """
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  GRADING_PROMPT = """ Instructions to Examiners:
17
  Abbreviations:
18
  - M: Marks for correct Method.
 
9
  genai.configure(api_key=os.getenv("GEMINI_API_KEY"))
10
 
11
  # ---------- PROMPTS ----------
12
+ TRANSCRIPTION_PROMPT = """ Your Role: You are an expert technical transcriber specializing in mathematical and scientific documents. Your mission is to convert handwritten solutions from a provided image or PDF into a clean, accurate, and logically structured Markdown format.
13
+ Primary Objective: Preserve the author's intended solution path while filtering out all mistakes, corrections, and extraneous marks. The final output must be perfectly formatted and easy to follow.
14
+ Core Instructions:
15
+ Hierarchical Structure:
16
+ Identify all questions and subquestions based on their numbering (e.g., 1. a), ### i)).
17
+ Use ## for main questions (e.g., ## Question 1).
18
+ Use ### for subquestions (e.g., ### a), ### i)).
19
+ If a question number appears out of its logical sequence, transcribe it with the label provided in the source.
20
+ What to Exclude (Content Filtration):
21
+ Mistakes: Completely ignore and do not transcribe any number, variable, or expression that has been struck through, scribbled over, or crossed out. Transcribe only the corrected, final version.
22
+ Extraneous Marks: Do not include any doodles, underlines (unless part of a fraction), or stray marks not relevant to the solution.
23
+ Crucial Distinction: Cancellations vs. Step Cuts:
24
+ Term Cancellation: This is a valid mathematical step where terms cancel each other out (e.g., +2x and -2x, or a term divided by itself).
25
+ Action: Transcribe the step where the cancellation occurs. Immediately after that line, add a concise, bracketed note explaining what was cancelled.
26
+ Step Cut: This is when the author skips intermediate algebraic or arithmetic steps (e.g., jumping from 2b = 2 directly to b = 1).
27
+ Action: Transcribe the steps exactly as they appear. Do not invent or add the missing steps. The logical jump in the transcribed output serves to represent the step cut.
28
+ Formatting and Special Cases:
29
+ Equations: Enclose all mathematical equations and multi-line calculations in Markdown code blocks for clarity and proper rendering.
30
+ Illegibility: If a specific word or number is impossible to read, use the placeholder [illegible].
31
+ Graphs: Do not attempt to recreate graphs. Instead, describe them textually. Note the type of curve (e.g., parabola, polynomial) and list any labeled key points like intercepts, vertices, or asymptotes."""
32
  GRADING_PROMPT = """ Instructions to Examiners:
33
  Abbreviations:
34
  - M: Marks for correct Method.