imperiusrex commited on
Commit
b548a65
·
verified ·
1 Parent(s): 5828679

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -18,9 +18,8 @@ clip_model = CLIPModel.from_pretrained("openai/clip-vit-large-patch14").to("cuda
18
  processor = CLIPProcessor.from_pretrained("openai/clip-vit-large-patch14")
19
 
20
  # Initialize Paddle's text detection model.
21
- # The 'use_gpu=True' parameter is crucial here to ensure it uses the GPU.
22
- # The model will be downloaded and loaded into GPU memory once.
23
- det_model = TextDetection(model_name="PP-OCRv5_server_det", use_gpu=True)
24
 
25
  # Candidate language phrases for detection
26
  candidates = [
@@ -125,8 +124,8 @@ def ocr_pipeline(image: Image.Image) -> str:
125
  lang_code = lang_map.get(detected_lang, "en")
126
 
127
  # Initialize PaddleOCR with the detected language.
128
- # This part will run fast as the H200 GPU accelerates the model.
129
- ocr = PaddleOCR(lang=lang_code, use_gpu=True, use_angle_cls=False, use_doc_unwarping=False)
130
  result = ocr.predict(img)
131
 
132
  # Extract text from OCR result
 
18
  processor = CLIPProcessor.from_pretrained("openai/clip-vit-large-patch14")
19
 
20
  # Initialize Paddle's text detection model.
21
+ # REMOVED the 'use_gpu=True' argument to fix the ValueError.
22
+ det_model = TextDetection(model_name="PP-OCRv5_server_det")
 
23
 
24
  # Candidate language phrases for detection
25
  candidates = [
 
124
  lang_code = lang_map.get(detected_lang, "en")
125
 
126
  # Initialize PaddleOCR with the detected language.
127
+ # REMOVED the 'use_gpu=True' argument here as well.
128
+ ocr = PaddleOCR(lang=lang_code, use_angle_cls=False, use_doc_unwarping=False)
129
  result = ocr.predict(img)
130
 
131
  # Extract text from OCR result