Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
@@ -8,10 +8,12 @@ import os
|
|
8 |
# Initialize FastAPI app
|
9 |
app = FastAPI()
|
10 |
|
11 |
-
# Define upload folder
|
12 |
UPLOAD_FOLDER = "static/uploads/"
|
|
|
|
|
13 |
if not os.path.exists(UPLOAD_FOLDER):
|
14 |
-
os.makedirs(UPLOAD_FOLDER)
|
15 |
|
16 |
# Inform pytesseract where Tesseract is installed
|
17 |
pytesseract.pytesseract.tesseract_cmd = "/usr/local/bin/tesseract"
|
|
|
8 |
# Initialize FastAPI app
|
9 |
app = FastAPI()
|
10 |
|
11 |
+
# Define the upload folder path
|
12 |
UPLOAD_FOLDER = "static/uploads/"
|
13 |
+
|
14 |
+
# Ensure the 'uploads' folder exists and has correct permissions
|
15 |
if not os.path.exists(UPLOAD_FOLDER):
|
16 |
+
os.makedirs(UPLOAD_FOLDER, mode=0o777) # Create folder with read, write, execute permissions for everyone
|
17 |
|
18 |
# Inform pytesseract where Tesseract is installed
|
19 |
pytesseract.pytesseract.tesseract_cmd = "/usr/local/bin/tesseract"
|