Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -14,7 +14,26 @@ st.set_page_config(
|
|
| 14 |
layout="wide",
|
| 15 |
initial_sidebar_state="collapsed"
|
| 16 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
# Try to import C++ module
|
| 19 |
try:
|
| 20 |
import cubic_cpp
|
|
|
|
| 14 |
layout="wide",
|
| 15 |
initial_sidebar_state="collapsed"
|
| 16 |
)
|
| 17 |
+
# Add at the beginning of app.py, before the import attempt
|
| 18 |
+
import os
|
| 19 |
+
import sys
|
| 20 |
+
|
| 21 |
+
# Try to find the module in common locations
|
| 22 |
+
module_locations = [
|
| 23 |
+
os.getcwd(),
|
| 24 |
+
os.path.dirname(os.path.abspath(__file__)),
|
| 25 |
+
'/home/user/app',
|
| 26 |
+
'/home/user/a'
|
| 27 |
+
]
|
| 28 |
|
| 29 |
+
for loc in module_locations:
|
| 30 |
+
if loc not in sys.path:
|
| 31 |
+
sys.path.insert(0, loc)
|
| 32 |
+
|
| 33 |
+
# Check for the module file
|
| 34 |
+
for ext in ['.so', '.cpython-310-x86_64-linux-gnu.so', '.cpython-310-aarch64-linux-gnu.so']:
|
| 35 |
+
if os.path.exists(os.path.join(loc, f'cubic_cpp{ext}')):
|
| 36 |
+
print(f"Found module at: {os.path.join(loc, f'cubic_cpp{ext}')}")
|
| 37 |
# Try to import C++ module
|
| 38 |
try:
|
| 39 |
import cubic_cpp
|