thhung commited on
Commit
3627d09
·
1 Parent(s): f118af2

[app] update app

Browse files
Files changed (2) hide show
  1. app.py +69 -0
  2. requirements.txt +91 -0
app.py ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from git import Repo
2
+ import os
3
+
4
+ import shutil
5
+ from distutils.dir_util import copy_tree
6
+
7
+ import subprocess
8
+
9
+ git_url = os.getenv("GIT_URL")
10
+ repo_dir = "./my_number_temp"
11
+ # Specify the path to the folder
12
+ # Check if the folder exists and remove it if it does
13
+ if os.path.exists(repo_dir) and os.path.isdir(repo_dir):
14
+ print(f"Already clone")
15
+ else:
16
+ print(f"Folder '{repo_dir}' does not exist.")
17
+ Repo.clone_from(git_url, repo_dir)
18
+
19
+ if os.getenv("FORCE", 'NO') != 'NO':
20
+ shutil.rmtree(repo_dir)
21
+ print("Force clone")
22
+ Repo.clone_from(git_url, repo_dir)
23
+
24
+ # Specify the folder you want to move and the current folder path
25
+ source_folder = "./my_number_temp/query_builder/"
26
+ destination_folder = f"{os.getcwd()}/query_builder" # Gets the path of the current
27
+
28
+ print(destination_folder)
29
+ # Check if the destination folder exists and remove it if it does
30
+ # if not os.path.exists(destination_folder):
31
+ os.makedirs(destination_folder,exist_ok=True)
32
+ # Copy the source folder to the destination
33
+ copy_tree(source_folder, destination_folder)
34
+
35
+ shutil.copy("./my_number_temp/prepare.sh", f"{os.getcwd()}")
36
+
37
+ _ = subprocess.run(['bash', "./prepare.sh"], capture_output=True, text=True)
38
+
39
+ import time
40
+
41
+ import streamlit as st
42
+
43
+ from query_builder import query_suggestion
44
+
45
+
46
+ # Streamlit app interface
47
+ def main():
48
+ st.title("Query Suggestion")
49
+ user_input = st.text_area("Enter your request:", height=100)
50
+
51
+ if st.button("Submit"):
52
+ # Record start time
53
+ start_time = time.time()
54
+ result = query_suggestion(user_input)
55
+ # Record end time
56
+ end_time = time.time()
57
+ processing_time_ms = (end_time - start_time) * 1000
58
+
59
+ # Display the results
60
+ st.subheader("Query suggests for you:")
61
+ for i, item in enumerate(result, 1):
62
+ st.write(f"{i}. {item}")
63
+
64
+ # Display processing time
65
+ st.write(f"Processing Time: {processing_time_ms:.2f} ms")
66
+
67
+
68
+ if __name__ == "__main__":
69
+ main()
requirements.txt ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ aiohappyeyeballs==2.4.3
2
+ aiohttp==3.10.10
3
+ aiosignal==1.3.1
4
+ altair==5.4.1
5
+ annotated-types==0.7.0
6
+ anyio==4.6.2.post1
7
+ attrs==24.2.0
8
+ blinker==1.9.0
9
+ cachetools==5.5.0
10
+ certifi==2024.8.30
11
+ charset-normalizer==3.4.0
12
+ click==8.1.7
13
+ coloredlogs==15.0.1
14
+ datasets==3.1.0
15
+ dill==0.3.8
16
+ faiss-cpu==1.9.0
17
+ fastapi==0.115.5
18
+ filelock==3.13.1
19
+ flatbuffers==24.3.25
20
+ frozenlist==1.5.0
21
+ fsspec==2024.2.0
22
+ gitdb==4.0.11
23
+ GitPython==3.1.43
24
+ h11==0.14.0
25
+ huggingface-hub==0.26.2
26
+ humanfriendly==10.0
27
+ idna==3.10
28
+ Jinja2==3.1.4
29
+ joblib==1.4.2
30
+ jsonschema==4.23.0
31
+ jsonschema-specifications==2024.10.1
32
+ markdown-it-py==3.0.0
33
+ MarkupSafe==3.0.2
34
+ mdurl==0.1.2
35
+ mpmath==1.3.0
36
+ multidict==6.1.0
37
+ multiprocess==0.70.16
38
+ narwhals==1.13.5
39
+ networkx==3.2.1
40
+ numpy==2.1.3
41
+ onnx==1.17.0
42
+ onnxruntime==1.20.0
43
+ optimum==1.23.3
44
+ packaging==24.2
45
+ pandas==2.2.3
46
+ pillow==11.0.0
47
+ propcache==0.2.0
48
+ protobuf==5.28.3
49
+ pyarrow==18.0.0
50
+ pydantic==2.9.2
51
+ pydantic_core==2.23.4
52
+ pydeck==0.9.1
53
+ Pygments==2.18.0
54
+ python-dateutil==2.9.0.post0
55
+ pytz==2024.2
56
+ PyYAML==6.0.2
57
+ referencing==0.35.1
58
+ regex==2024.11.6
59
+ requests==2.32.3
60
+ rich==13.9.4
61
+ rpds-py==0.21.0
62
+ safetensors==0.4.5
63
+ scikit-learn==1.5.2
64
+ scipy==1.14.1
65
+ sentence-transformers==3.3.0
66
+ setuptools==75.1.0
67
+ six==1.16.0
68
+ smmap==5.0.1
69
+ sniffio==1.3.1
70
+ starlette==0.41.2
71
+ streamlit==1.40.1
72
+ sympy==1.13.1
73
+ tenacity==9.0.0
74
+ threadpoolctl==3.5.0
75
+ tokenizers==0.20.3
76
+ toml==0.10.2
77
+ torch==2.5.1+cpu
78
+ torchaudio==2.5.1+cpu
79
+ torchvision==0.20.1+cpu
80
+ tornado==6.4.1
81
+ tqdm==4.67.0
82
+ transformers==4.46.2
83
+ typing_extensions==4.12.2
84
+ tzdata==2024.2
85
+ urllib3==2.2.3
86
+ uvicorn==0.32.0
87
+ watchdog==6.0.0
88
+ wheel==0.44.0
89
+ xxhash==3.5.0
90
+ yarl==1.17.1
91
+ GitPython