Spaces:
Runtime error
Runtime error
crystalchen
commited on
Update app.py
Browse filesapp os.system to install poppler utils
app.py
CHANGED
@@ -1,5 +1,12 @@
|
|
1 |
-
|
2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
from pdf2image import convert_from_path
|
4 |
import cv2
|
5 |
import numpy as np
|
@@ -16,6 +23,16 @@ def get_base64_encorded_image(image_path):
|
|
16 |
base64_string = base64_encorded_data.decode('utf-8')
|
17 |
return base64_string
|
18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
## Process pdf
|
20 |
|
21 |
def convert_pdf_to_image(pdf_path):
|
|
|
1 |
+
## Set Environment
|
2 |
+
import os
|
3 |
+
os.system('python -m venv env')
|
4 |
+
os.system('source env/bin/activate')
|
5 |
+
## Install poppler in os
|
6 |
+
os.system('apt-get update')
|
7 |
+
os.system('sudo apt-get install poppler-utils')
|
8 |
+
##
|
9 |
+
import os
|
10 |
from pdf2image import convert_from_path
|
11 |
import cv2
|
12 |
import numpy as np
|
|
|
23 |
base64_string = base64_encorded_data.decode('utf-8')
|
24 |
return base64_string
|
25 |
|
26 |
+
## Set Environment
|
27 |
+
os.system('python -m venv env')
|
28 |
+
os.system('source env/bin/activate')
|
29 |
+
## Install poppler in os
|
30 |
+
import os
|
31 |
+
os.system('apt-get update')
|
32 |
+
os.system('sudo apt-get install poppler-utils')
|
33 |
+
|
34 |
+
## The rest of your app.py code goes here
|
35 |
+
|
36 |
## Process pdf
|
37 |
|
38 |
def convert_pdf_to_image(pdf_path):
|