MISSAOUI commited on
Commit
8a6ae60
·
verified ·
1 Parent(s): 104d480

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -38,11 +38,10 @@ async def ocr_image(file: UploadFile = File(...)):
38
  extracted_text = response.text
39
 
40
  # If PDF generation is desired:
41
- # create_receipt(extracted_text, file_name="result/receipt.pdf")
42
- # return FileResponse("result/receipt.pdf", filename="receipt.pdf", media_type="application/pdf")
43
 
44
- # FIX: return correct JSON matching OCRResponse
45
- return {"extracted_text": extracted_text}
46
 
47
  except Exception as e:
48
  raise HTTPException(status_code=500, detail=f"OCR failed: {str(e)}")
 
38
  extracted_text = response.text
39
 
40
  # If PDF generation is desired:
41
+ create_receipt(extracted_text, file_name="result/receipt.pdf")
42
+ return FileResponse("result/receipt.pdf", filename="receipt.pdf", media_type="application/pdf")
43
 
44
+
 
45
 
46
  except Exception as e:
47
  raise HTTPException(status_code=500, detail=f"OCR failed: {str(e)}")