Skip to content

Commit 095d35a

Browse files
anngoroshianna.yamkovayad0rich
authored
Resolve #4 Migrate to streamlit app (#7)
* implemented new structure for preparing to use streamlit * file's removing regarding new structure * file's removing regarding new structure and fixing imports * changed imports * add upload annotations and requirements pages * added entry point to main.py * added main page and pages with uploading * updated Readme * rename file link_reqs_to_annos.py * add uploading annotations from files * small changes * added upload requirements * a few UI changes * some small changes in structure of pages * add showing report on inspect page * update uv dependencies * added disabling Streamlit's file watcher * updated navigation * added start a trace * added logging and writing to csv file * rebase to master * fixed RETURING * Revert "fixed RETURING" This reverts commit fccec8b. * rebase to master * rebase to master * rebase master * fixed RETURING * Revert "fixed RETURING" This reverts commit fccec8b. * fixed RETURING * Revert "fixed RETURING" This reverts commit fccec8b. * fixed rebase * Update convert_trace_annos.py Co-authored-by: Nikolai Dorofeev <[email protected]> * improved reading of trace files * couple of improvements * fixed logging * added streamlit to dependencies * added changes from master * small fixes * update uv lock * changes in project structure * fixed imports in tests * deleted unused code in report.py * updated UI * fixed batch * rewrite visualize vectors by using streamlit * added cache distances to the app * add cache distances to app * small changes * Fixed plotting * Fixed plotting * Fixed reporting * Fixed closing db connection * updated dependencies * speeded up page loading Co-authored-by: Nikolai Dorofeev <[email protected]> * speeded up page loading Co-authored-by: Nikolai Dorofeev <[email protected]> * speeded up page loading Co-authored-by: Nikolai Dorofeev <[email protected]> * updated Readme * Speeded up pages loading regarding best practices --------- Co-authored-by: anna.yamkovaya <[email protected]> Co-authored-by: Nikolai Dorofeev <[email protected]>
1 parent 8dbbe15 commit 095d35a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1257
-418
lines changed

.streamlit/config.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[server]
2+
fileWatcherType = "none"

README.md

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
## Setup
22

3-
This project uses UV to manage the virtual environment. To install UV, run the following command:
3+
This project uses:
4+
- python version higher than 3.9 with sqlite version higher than 3.35 with option enable load extentions.
5+
- UV to manage the virtual environment. To install UV, run the following command:
46

57
```bash
68
pip install uv
@@ -90,11 +92,14 @@ erDiagram
9092

9193
## Usage
9294

93-
1. Add your artifacts to the `private` directory.
94-
2. Run `index_annotations.py` to index the annotations. It also fills information about the test cases.
95-
3. Run `index_requirements.py` to index the requirements.
96-
4. Run `link_reqs_to_annos.py` to find the closest annotations to each requirement and cache this data in
97-
`CasesToAnnos` table.
98-
5. Create report about the coverage of the requirements by the test cases:
99-
- By running your SQL queries in `requirements.db` SQLite database.
100-
- Or by running `report.py` script.
95+
To run UI of this app use following command:
96+
97+
```shell
98+
streamlit run main.py
99+
```
100+
101+
For running first time use following command to install dependencies if necessary
102+
103+
```shell
104+
uv run streamlit run main.py
105+
```

index_annotations.py

Lines changed: 0 additions & 67 deletions
This file was deleted.

main.py

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import streamlit as st
2+
3+
from test2text.pages.upload.annotations import show_annotations
4+
from test2text.pages.upload.requirements import show_requirements
5+
from test2text.services.embeddings.cache_distances import show_distances_histogram
6+
from test2text.pages.report import make_a_report
7+
from test2text.services.visualisation.visualize_vectors import visualize_vectors
8+
9+
10+
def add_logo():
11+
st.markdown(
12+
"""
13+
<style>
14+
[data-testid="stSidebarNav"] {
15+
background-image: url();
16+
background-repeat: no-repeat;
17+
padding-top: 10px;
18+
background-position: 20px 20px;
19+
}
20+
[data-testid="stSidebarNav"]::before {
21+
content: "📑 Test2Text";
22+
margin-left: 20px;
23+
margin-top: 20px;
24+
font-size: 30px;
25+
position: relative;
26+
top: 0px;
27+
}
28+
</style>
29+
""",
30+
unsafe_allow_html=True,
31+
)
32+
33+
34+
if __name__ == "__main__":
35+
st.set_page_config(page_title="Test2Text App", layout="wide", initial_sidebar_state="auto")
36+
add_logo()
37+
38+
annotations = st.Page(show_annotations,
39+
title="Annotations", icon=":material/database_upload:")
40+
requirements = st.Page(show_requirements,
41+
title="Requirements", icon=":material/database_upload:")
42+
cache_distances = st.Page(show_distances_histogram,
43+
title="Cache Distances", icon=":material/cached:")
44+
report = st.Page(make_a_report,
45+
title="Report", icon=":material/publish:")
46+
visualization = st.Page(visualize_vectors,
47+
title="Visualize Vectors", icon=":material/dataset:")
48+
pages = {
49+
"Upload": [annotations, requirements],
50+
"Update": [cache_distances],
51+
"Inspect": [report, visualization],
52+
}
53+
pg = st.navigation(pages)
54+
55+
pg.run()
56+

pyproject.toml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,15 @@ authors = [
88
readme = "README.md"
99
requires-python = ">=3.9"
1010
dependencies = [
11+
"einops>=0.8.1",
1112
"matplotlib>=3.9.4",
13+
"sentence-transformers>=4.0.1",
1214
"sqlite-vec>=0.1.6",
13-
"tabbyset>=1.0.0"
15+
"tabbyset>=1.0.0",
16+
"streamlit>=1.47.0",
17+
"blinker>=1.9.0",
18+
"google>=3.0.0",
19+
"plotly>=6.2.0",
1420
]
1521

1622
[dependency-groups]

report.py

Lines changed: 0 additions & 131 deletions
This file was deleted.

0 commit comments

Comments
 (0)