Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
@@ -9,8 +9,16 @@ import numpy as np
|
|
9 |
# Initialize FastAPI app
|
10 |
app = FastAPI()
|
11 |
|
12 |
-
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
# Serve static files (images, etc.)
|
16 |
# app.mount("/static", StaticFiles(directory="static"), name="static") # Not needed if you're not saving the images
|
|
|
9 |
# Initialize FastAPI app
|
10 |
app = FastAPI()
|
11 |
|
12 |
+
import subprocess
|
13 |
+
|
14 |
+
def install_tesseract():
|
15 |
+
try:
|
16 |
+
subprocess.run(['apt-get', 'update'], check=True)
|
17 |
+
subprocess.run(['apt-get', 'install', '-y', 'tesseract-ocr'], check=True)
|
18 |
+
except subprocess.CalledProcessError as e:
|
19 |
+
print(f"Error installing Tesseract: {e}")
|
20 |
+
|
21 |
+
install_tesseract()
|
22 |
|
23 |
# Serve static files (images, etc.)
|
24 |
# app.mount("/static", StaticFiles(directory="static"), name="static") # Not needed if you're not saving the images
|