feat: change ui entry (#197)

change ui start cmd
This commit is contained in:
XianBW
2024-08-09 17:23:45 +08:00
committed by GitHub
parent 048e820d3d
commit d82edc9c23
5 changed files with 19 additions and 5 deletions
+3 -3
View File
@@ -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:
@@ -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
+1 -1
View File
@@ -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>`.
+12
View File
@@ -5,6 +5,9 @@ This will
- 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
@@ -19,6 +22,14 @@ from rdagent.app.qlib_rd_loop.model import main as fin_model
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(
{
@@ -27,5 +38,6 @@ def app():
"fin_model": fin_model,
"med_model": med_model,
"general_model": general_model,
"ui": ui,
}
)
+3 -1
View File
@@ -2,6 +2,7 @@ import argparse
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
@@ -526,7 +527,8 @@ with st.container():
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

Before

Width:  |  Height:  |  Size: 123 KiB

After

Width:  |  Height:  |  Size: 123 KiB