Skip to content

Commit

Permalink
feat: change ui entry (#197)
Browse files Browse the repository at this point in the history
change ui start cmd
  • Loading branch information
XianBW authored Aug 9, 2024
1 parent 4a93329 commit fa5d335
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 5 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ You can try our demo by running the following command:
- 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.)
- please refer to [Configuration](docs/build/html/installation.html#azure-openai) for the detailed explanation of the `.env`
### 🚀 Run the Application
- Start streamlit web app to show log traces:
- Start web app to show log traces:
```sh
streamlit run rdagent/log/ui/app.py --server.port 8080 -- --log_dir <your log folder>
rdagent ui --port 80 --log_dir <your log folder>
```

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

# Scenarios
Expand Down
2 changes: 1 addition & 1 deletion docs/ui.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ In `RD-Agent/` folder, run:

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

Expand Down
12 changes: 12 additions & 0 deletions rdagent/app/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
- make rdagent a nice entry and
- autoamtically load dotenv
"""
import subprocess
from importlib.resources import path as rpath

import fire
from dotenv import load_dotenv

Expand All @@ -19,6 +22,14 @@
load_dotenv()


def ui(port=80, log_dir="./log"):
"""
start web app to show the log traces.
"""
with rpath("rdagent.log.ui", "app.py") as app_path:
subprocess.run(["streamlit", "run", app_path, f"--server.port={port}", "--", f"--log_dir={log_dir}"])


def app():
fire.Fire(
{
Expand All @@ -27,5 +38,6 @@ def app():
"fin_model": fin_model,
"med_model": med_model,
"general_model": general_model,
"ui": ui,
}
)
4 changes: 3 additions & 1 deletion rdagent/log/ui/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import textwrap
from collections import defaultdict
from datetime import datetime, timezone
from importlib.resources import files as rfiles
from pathlib import Path
from typing import Callable, Type

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

0 comments on commit fa5d335

Please sign in to comment.