modify: add docker

This commit is contained in:
2025-11-02 22:30:59 +08:00
parent d8eea8e3a9
commit d94b5c5ba4
4 changed files with 81 additions and 2 deletions

View File

@@ -68,6 +68,25 @@ pip install streamlit-autorefresh openpyxl xlrd cryptography openai
3. Open `http://localhost:8501` in your browser. The home page should load without import errors.
## 5. Run with Docker (optional)
If you prefer an isolated container build, use the included `Dockerfile`:
```bash
docker build -t trafficsafeanalyzer .
docker run --rm -p 8501:8501 trafficsafeanalyzer
```
To work with local data, mount the host folder containing Excel files:
```bash
docker run --rm -p 8501:8501 \
-v "$(pwd)/sample:/app/sample" \
trafficsafeanalyzer
```
The container exposes Streamlit on port 8501 by default. Override configuration via environment variables when needed, for example `-e STREAMLIT_SERVER_PORT=8502`.
## Troubleshooting tips
- **Missing package**: Re-run `pip install -r requirements.txt`.

View File

@@ -4,7 +4,7 @@ TrafficSafeAnalyzer delivers accident analytics and decision support through a S
## Start the app
1. Activate your virtual or conda environment.
1. Activate your virtual or conda environment(或在容器中运行,见下).
2. From the project root, run:
```bash
@@ -13,6 +13,8 @@ TrafficSafeAnalyzer delivers accident analytics and decision support through a S
3. Open `http://localhost:8501`. Keep the terminal running while you work in the browser.
> 使用 Docker运行 `docker build -t trafficsafeanalyzer .` 与 `docker run --rm -p 8501:8501 trafficsafeanalyzer` 后,同样访问 `http://localhost:8501`。
## Load input data
Use the sidebar form labelled “数据与筛选”.