Binayak Panigrahi commited on
Commit
6af1a5f
·
1 Parent(s): 42fa356

Add application file

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -93,7 +93,7 @@ async def run_ocr(file: UploadFile) -> str:
93
  content = await file.read()
94
  image_b64 = base64.b64encode(content).decode()
95
 
96
- if len(image_b64) >= 180_000:
97
  raise HTTPException(
98
  status_code=413,
99
  detail="Image too large (base64 > 180 KB). Resize the image and try again.",
@@ -158,7 +158,7 @@ def call_llm(ocr_text: str, system_prompt: str) -> dict:
158
  }
159
 
160
  try:
161
- llm_response = requests.post(LLM_URL, headers=LLM_HEADERS, json=llm_payload, timeout=60)
162
  llm_response.raise_for_status()
163
  llm_json = llm_response.json()
164
  print("LLM Response JSON:", llm_json)
 
93
  content = await file.read()
94
  image_b64 = base64.b64encode(content).decode()
95
 
96
+ if len(image_b64) >= 500_000:
97
  raise HTTPException(
98
  status_code=413,
99
  detail="Image too large (base64 > 180 KB). Resize the image and try again.",
 
158
  }
159
 
160
  try:
161
+ llm_response = requests.post(LLM_URL, headers=LLM_HEADERS, json=llm_payload, timeout=200)
162
  llm_response.raise_for_status()
163
  llm_json = llm_response.json()
164
  print("LLM Response JSON:", llm_json)