Spaces:
Sleeping
Sleeping
Fix import issues and update package structure
Browse files- Simplified import statements in streamlit_app.py
- Updated app.py to set up Python path correctly
- Fixed Dockerfile working directory
- Updated setup.py to include all packages
- Added MANIFEST.in for proper package distribution
- Dockerfile +5 -0
- MANIFEST.in +7 -0
- app.py +5 -5
- setup.py +5 -2
- src/streamlit_app.py +6 -10
Dockerfile
CHANGED
|
@@ -68,6 +68,8 @@ ENV HOST=0.0.0.0 \
|
|
| 68 |
# Install the package in development mode
|
| 69 |
WORKDIR /app
|
| 70 |
COPY . .
|
|
|
|
|
|
|
| 71 |
RUN pip install -e .
|
| 72 |
|
| 73 |
# Install Playwright browsers
|
|
@@ -76,6 +78,9 @@ RUN playwright install --with-deps
|
|
| 76 |
# Expose port
|
| 77 |
EXPOSE 8501
|
| 78 |
|
|
|
|
|
|
|
|
|
|
| 79 |
# Health check
|
| 80 |
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
|
| 81 |
CMD curl --fail http://localhost:8501/_stcore/health || exit 1
|
|
|
|
| 68 |
# Install the package in development mode
|
| 69 |
WORKDIR /app
|
| 70 |
COPY . .
|
| 71 |
+
|
| 72 |
+
# Install the package in development mode
|
| 73 |
RUN pip install -e .
|
| 74 |
|
| 75 |
# Install Playwright browsers
|
|
|
|
| 78 |
# Expose port
|
| 79 |
EXPOSE 8501
|
| 80 |
|
| 81 |
+
# Set the working directory to the app root
|
| 82 |
+
WORKDIR /app
|
| 83 |
+
|
| 84 |
# Health check
|
| 85 |
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
|
| 86 |
CMD curl --fail http://localhost:8501/_stcore/health || exit 1
|
MANIFEST.in
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
include README.md
|
| 2 |
+
include requirements.txt
|
| 3 |
+
include LICENSE
|
| 4 |
+
recursive-include src *.py
|
| 5 |
+
recursive-include src *.json
|
| 6 |
+
recursive-include src *.yaml
|
| 7 |
+
recursive-include src *.txt
|
app.py
CHANGED
|
@@ -5,13 +5,13 @@ Main entry point for the Agentic Browser application.
|
|
| 5 |
import os
|
| 6 |
import sys
|
| 7 |
|
| 8 |
-
# Add the
|
| 9 |
-
|
| 10 |
-
if
|
| 11 |
-
sys.path.insert(0,
|
| 12 |
|
| 13 |
# Import and run the Streamlit app
|
| 14 |
-
from streamlit_app import main
|
| 15 |
|
| 16 |
if __name__ == "__main__":
|
| 17 |
main()
|
|
|
|
| 5 |
import os
|
| 6 |
import sys
|
| 7 |
|
| 8 |
+
# Add the project root to the Python path
|
| 9 |
+
project_root = os.path.dirname(os.path.abspath(__file__))
|
| 10 |
+
if project_root not in sys.path:
|
| 11 |
+
sys.path.insert(0, project_root)
|
| 12 |
|
| 13 |
# Import and run the Streamlit app
|
| 14 |
+
from src.streamlit_app import main
|
| 15 |
|
| 16 |
if __name__ == "__main__":
|
| 17 |
main()
|
setup.py
CHANGED
|
@@ -28,8 +28,11 @@ setup(
|
|
| 28 |
url="https://huggingface.co/spaces/anu151105/agentic-browser",
|
| 29 |
|
| 30 |
# Package configuration
|
| 31 |
-
packages=find_packages(where='src'),
|
| 32 |
-
package_dir={
|
|
|
|
|
|
|
|
|
|
| 33 |
include_package_data=True,
|
| 34 |
package_data={
|
| 35 |
'': ['*.json', '*.yaml', '*.txt', '*.md'],
|
|
|
|
| 28 |
url="https://huggingface.co/spaces/anu151105/agentic-browser",
|
| 29 |
|
| 30 |
# Package configuration
|
| 31 |
+
packages=find_packages(where='src') + find_packages(where='src/models'),
|
| 32 |
+
package_dir={
|
| 33 |
+
'': 'src',
|
| 34 |
+
'models': 'src/models'
|
| 35 |
+
},
|
| 36 |
include_package_data=True,
|
| 37 |
package_data={
|
| 38 |
'': ['*.json', '*.yaml', '*.txt', '*.md'],
|
src/streamlit_app.py
CHANGED
|
@@ -4,17 +4,13 @@ import os
|
|
| 4 |
import sys
|
| 5 |
from pathlib import Path
|
| 6 |
|
| 7 |
-
# Add the
|
| 8 |
-
|
| 9 |
-
if
|
| 10 |
-
sys.path.insert(0,
|
| 11 |
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
from .models.model_manager import model_manager
|
| 15 |
-
except ImportError:
|
| 16 |
-
# Fall back to absolute import
|
| 17 |
-
from models.model_manager import model_manager
|
| 18 |
|
| 19 |
# Set page config
|
| 20 |
st.set_page_config(
|
|
|
|
| 4 |
import sys
|
| 5 |
from pathlib import Path
|
| 6 |
|
| 7 |
+
# Add the project root to the Python path
|
| 8 |
+
project_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
| 9 |
+
if project_root not in sys.path:
|
| 10 |
+
sys.path.insert(0, project_root)
|
| 11 |
|
| 12 |
+
# Import model manager using absolute import
|
| 13 |
+
from src.models.model_manager import model_manager
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
# Set page config
|
| 16 |
st.set_page_config(
|