Skip to content

Commit fa5d335

Browse files
authored
feat: change ui entry (#197)
change ui start cmd
1 parent 4a93329 commit fa5d335

File tree

5 files changed

+19
-5
lines changed

5 files changed

+19
-5
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ You can try our demo by running the following command:
7272
- The `.env.example` file contains the environment variables required for users using the OpenAI API (Please note that `.env.example` is an example file. `.env` is the one that will be finally used.)
7373
- please refer to [Configuration](docs/build/html/installation.html#azure-openai) for the detailed explanation of the `.env`
7474
### 🚀 Run the Application
75-
- Start streamlit web app to show log traces:
75+
- Start web app to show log traces:
7676
```sh
77-
streamlit run rdagent/log/ui/app.py --server.port 8080 -- --log_dir <your log folder>
77+
rdagent ui --port 80 --log_dir <your log folder>
7878
```
7979

8080
The [🎥demo](https://rdagent.azurewebsites.net) is implemented by the following commands:
@@ -108,7 +108,7 @@ The [🎥demo](https://rdagent.azurewebsites.net) is implemented by the followin
108108
### 🚀 Monitor the Application
109109
- You can serve our demo app to monitor the RD loop by running the following command:
110110
```sh
111-
streamlit run rdagent/log/ui/app.py --server.port 8080 -- --log_dir <your log folder>
111+
rdagent ui --port 80 --log_dir <your log folder>
112112
```
113113

114114
# Scenarios

docs/ui.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ In `RD-Agent/` folder, run:
1818

1919
.. code-block:: bash
2020
21-
streamlit run rdagent/log/ui/app.py --server.port <port> -- --log_dir <log_dir>
21+
rdagent ui --port <port> --log_dir <log_dir>
2222
2323
This will start a web app on `http://localhost:<port>`.
2424

rdagent/app/cli.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
- make rdagent a nice entry and
66
- autoamtically load dotenv
77
"""
8+
import subprocess
9+
from importlib.resources import path as rpath
10+
811
import fire
912
from dotenv import load_dotenv
1013

@@ -19,6 +22,14 @@
1922
load_dotenv()
2023

2124

25+
def ui(port=80, log_dir="./log"):
26+
"""
27+
start web app to show the log traces.
28+
"""
29+
with rpath("rdagent.log.ui", "app.py") as app_path:
30+
subprocess.run(["streamlit", "run", app_path, f"--server.port={port}", "--", f"--log_dir={log_dir}"])
31+
32+
2233
def app():
2334
fire.Fire(
2435
{
@@ -27,5 +38,6 @@ def app():
2738
"fin_model": fin_model,
2839
"med_model": med_model,
2940
"general_model": general_model,
41+
"ui": ui,
3042
}
3143
)

rdagent/log/ui/app.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import textwrap
33
from collections import defaultdict
44
from datetime import datetime, timezone
5+
from importlib.resources import files as rfiles
56
from pathlib import Path
67
from typing import Callable, Type
78

@@ -526,7 +527,8 @@ def tasks_window(tasks: list[FactorTask | ModelTask]):
526527
with st.container():
527528
image_c, scen_c = st.columns([3, 3], vertical_alignment="center")
528529
with image_c:
529-
st.image("./docs/_static/flow.png")
530+
img_path = rfiles("rdagent.log.ui").joinpath("flow.png")
531+
st.image(str(img_path), use_column_width=True)
530532
with scen_c:
531533
st.header("Scenario Description📖", divider="violet", anchor="_scenario")
532534
# TODO: other scenarios
File renamed without changes.

0 commit comments

Comments
 (0)