Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
#
|
| 22 |
-
|
| 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 |
-
#
|
| 129 |
-
ocr = PaddleOCR(lang=lang_code,
|
| 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
|