Spaces:
Sleeping
Sleeping
Gnanashri Kota Venkatesh commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import os
|
| 2 |
import re
|
| 3 |
import tempfile
|
|
@@ -14,10 +29,13 @@ from reportlab.lib import colors
|
|
| 14 |
from PIL import Image as PILImage
|
| 15 |
import io
|
| 16 |
import shutil
|
| 17 |
-
import cv2
|
| 18 |
import pandas as pd
|
| 19 |
-
|
| 20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
# Configure Streamlit page
|
| 22 |
st.set_page_config(
|
| 23 |
page_title="Brand Assets Tools",
|
|
|
|
| 1 |
+
import sys
|
| 2 |
+
import warnings
|
| 3 |
+
|
| 4 |
+
try:
|
| 5 |
+
import numpy as np
|
| 6 |
+
if np.__version__.startswith('2'):
|
| 7 |
+
warnings.warn("NumPy 2.x detected - forcing NumPy 1.x for OpenCV compatibility")
|
| 8 |
+
import subprocess
|
| 9 |
+
subprocess.check_call([sys.executable, "-m", "pip", "install", "numpy==1.26.4"])
|
| 10 |
+
import numpy as np # Re-import after install
|
| 11 |
+
except ImportError:
|
| 12 |
+
import subprocess
|
| 13 |
+
subprocess.check_call([sys.executable, "-m", "pip", "install", "numpy==1.26.4"])
|
| 14 |
+
import numpy as np
|
| 15 |
+
|
| 16 |
import os
|
| 17 |
import re
|
| 18 |
import tempfile
|
|
|
|
| 29 |
from PIL import Image as PILImage
|
| 30 |
import io
|
| 31 |
import shutil
|
|
|
|
| 32 |
import pandas as pd
|
| 33 |
+
try:
|
| 34 |
+
import cv2
|
| 35 |
+
CV2_AVAILABLE = True
|
| 36 |
+
except ImportError as e:
|
| 37 |
+
CV2_AVAILABLE = False
|
| 38 |
+
warnings.warn(f"OpenCV not available: {str(e)} - some image processing features may be limited")
|
| 39 |
# Configure Streamlit page
|
| 40 |
st.set_page_config(
|
| 41 |
page_title="Brand Assets Tools",
|