Edwin Salguero
commited on
Commit
·
2cebf25
1
Parent(s):
b93b70d
Fix streamlit_app.py to properly use imported main() function instead of always overriding with fallback
Browse files- streamlit_app.py +8 -1
streamlit_app.py
CHANGED
|
@@ -17,6 +17,8 @@ if frontend_dir not in sys.path:
|
|
| 17 |
if current_dir not in sys.path:
|
| 18 |
sys.path.insert(0, current_dir)
|
| 19 |
|
|
|
|
|
|
|
| 20 |
try:
|
| 21 |
# Import only the main function to avoid loading unnecessary modules
|
| 22 |
from frontend.app import main
|
|
@@ -38,4 +40,9 @@ except ImportError as e:
|
|
| 38 |
|
| 39 |
# Run the main function directly
|
| 40 |
if __name__ == "__main__":
|
| 41 |
-
main
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
if current_dir not in sys.path:
|
| 18 |
sys.path.insert(0, current_dir)
|
| 19 |
|
| 20 |
+
main = None # Initialize main as None
|
| 21 |
+
|
| 22 |
try:
|
| 23 |
# Import only the main function to avoid loading unnecessary modules
|
| 24 |
from frontend.app import main
|
|
|
|
| 40 |
|
| 41 |
# Run the main function directly
|
| 42 |
if __name__ == "__main__":
|
| 43 |
+
if main is not None:
|
| 44 |
+
main()
|
| 45 |
+
else:
|
| 46 |
+
import streamlit as st
|
| 47 |
+
st.error("Failed to import main application. Please check the deployment.")
|
| 48 |
+
st.info("Contact support if this issue persists.")
|