ariG23498 HF Staff commited on
Commit
af9adc0
·
verified ·
1 Parent(s): c4662ea

Upload PaddlePaddle_PaddleOCR-VL_0.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. PaddlePaddle_PaddleOCR-VL_0.py +23 -9
PaddlePaddle_PaddleOCR-VL_0.py CHANGED
@@ -23,17 +23,31 @@ try:
23
  with open('PaddlePaddle_PaddleOCR-VL_0.txt', 'w', encoding='utf-8') as f:
24
  f.write('Everything was good in PaddlePaddle_PaddleOCR-VL_0.txt')
25
  except Exception as e:
26
- with open('PaddlePaddle_PaddleOCR-VL_0.txt', 'w', encoding='utf-8') as f:
 
 
 
 
 
 
 
 
27
  import traceback
28
- traceback.print_exc(file=f)
 
29
 
30
- import os
31
- from slack_sdk import WebClient
32
- client = WebClient(token=os.environ['SLACK_TOKEN'])
33
- client.chat_postMessage(
34
- channel='#exp-slack-alerts',
35
- text='Problem in <https://huggingface.co/datasets/model-metadata/code_execution_files/blob/main/PaddlePaddle_PaddleOCR-VL_0.txt|PaddlePaddle_PaddleOCR-VL_0.txt>',
36
- )
 
 
 
 
 
37
  finally:
38
  from huggingface_hub import upload_file
39
  upload_file(
 
23
  with open('PaddlePaddle_PaddleOCR-VL_0.txt', 'w', encoding='utf-8') as f:
24
  f.write('Everything was good in PaddlePaddle_PaddleOCR-VL_0.txt')
25
  except Exception as e:
26
+ import os
27
+ from slack_sdk import WebClient
28
+ client = WebClient(token=os.environ['SLACK_TOKEN'])
29
+ client.chat_postMessage(
30
+ channel='#exp-slack-alerts',
31
+ text='Problem in <https://huggingface.co/datasets/model-metadata/code_execution_files/blob/main/PaddlePaddle_PaddleOCR-VL_0.txt|PaddlePaddle_PaddleOCR-VL_0.txt>',
32
+ )
33
+
34
+ with open('PaddlePaddle_PaddleOCR-VL_0.txt', 'a', encoding='utf-8') as f:
35
  import traceback
36
+ f.write('```CODE:
37
+ # See https://www.paddleocr.ai/latest/version3.x/pipeline_usage/PaddleOCR-VL.html to installation
38
 
39
+ from paddleocr import PaddleOCRVL
40
+ pipeline = PaddleOCRVL()
41
+ output = pipeline.predict("path/to/document_image.png")
42
+ for res in output:
43
+ res.print()
44
+ res.save_to_json(save_path="output")
45
+ res.save_to_markdown(save_path="output")
46
+ ```
47
+ ERROR:
48
+ ')
49
+ traceback.print_exc(file=f)
50
+
51
  finally:
52
  from huggingface_hub import upload_file
53
  upload_file(