whyumesh commited on
Commit
8bd4f69
1 Parent(s): e82025d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -22
app.py CHANGED
@@ -68,33 +68,28 @@ def load_models():
68
 
69
  vision_model, vision_processor, code_model, code_tokenizer = load_models()
70
 
71
- VISION_SYSTEM_PROMPT = """You are an OCR system specialized in extracting code from images and videos. Your task is to:
72
- 1. Extract and output ONLY the exact code snippets visible in the image
73
- 2. Maintain exact formatting, indentation, and whitespace
74
- 3. Do not add any descriptions, analysis, or commentary
75
- 4. If there are error messages or console outputs visible, include them exactly as shown
76
- Output Format:
77
- ```[language]
78
- [extracted code here]
79
  If multiple code sections are visible, separate them with ---
80
  Note: In video, irrelevant frames may occur (e.g., other windows tabs, eterniq website, etc.) in video. Please focus on code-specific frames as we have to extract that content only.
81
  """
82
 
83
- CODE_SYSTEM_PROMPT = """You are an expert code debugging assistant. You will receive:
84
- 1. Original code (extracted by OCR)
85
- 2. User's description of the issue
86
- 3. Additional context if any
87
- Your task is to:
88
- 1. Analyze the provided code considering the user's description
89
- 2. Identify bugs and issues
90
- 3. Provide a corrected version of the code
91
- 4. Explain the specific fixes made
92
- Output Format:
93
  Fixed Code:
94
- [corrected code here]
95
- Original Code Issue:
96
- [Brief description of the issues based on user input and code analysis]
97
- Note: Please provide the output in a well-structured Markdown format. Remove all unnecessary information and exclude any additional code formatting such as triple backticks or language identifiers. The response should be ready to be rendered as Markdown content.
 
98
  """
99
  def process_video_for_code(video_path, transcribed_text, max_frames=16, frame_interval=30):
100
  cap = cv2.VideoCapture(video_path)
 
68
 
69
  vision_model, vision_processor, code_model, code_tokenizer = load_models()
70
 
71
+ VISION_SYSTEM_PROMPT = """Extract code from images/videos:
72
+ 1. Output exact code snippets only
73
+ 2. Keep original formatting/indentation
74
+ focus on code-relevant frames only
75
+ [code]
 
 
 
76
  If multiple code sections are visible, separate them with ---
77
  Note: In video, irrelevant frames may occur (e.g., other windows tabs, eterniq website, etc.) in video. Please focus on code-specific frames as we have to extract that content only.
78
  """
79
 
80
+ CODE_SYSTEM_PROMPT = """Debug code as an expert:
81
+ - Analyze OCR-extracted code + user's issue
82
+ - Find bugs/issues
83
+ - Provide fixes
84
+ - Explain corrections
85
+
86
+ Output:
 
 
 
87
  Fixed Code:
88
+ [corrected code]
89
+
90
+ Original Issue:
91
+ [brief analysis]
92
+ Note: Please provide the output in a well-structured Markdown format. Remove all unnecessary information and exclude any additional code formatting such as triple backticks or language identifiers.
93
  """
94
  def process_video_for_code(video_path, transcribed_text, max_frames=16, frame_interval=30):
95
  cap = cv2.VideoCapture(video_path)