from git import Repo import os import shutil from distutils.dir_util import copy_tree import subprocess git_url = os.getenv("GIT_URL") repo_dir = "./my_number_temp" # Specify the path to the folder # Check if the folder exists and remove it if it does if os.path.exists(repo_dir) and os.path.isdir(repo_dir): print(f"Already clone") else: print(f"Folder '{repo_dir}' does not exist.") Repo.clone_from(git_url, repo_dir) if os.getenv("FORCE", 'NO') != 'NO': shutil.rmtree(repo_dir) print("Force clone") Repo.clone_from(git_url, repo_dir) # Specify the folder you want to move and the current folder path source_folder = "./my_number_temp/query_builder/" destination_folder = f"{os.getcwd()}/query_builder" # Gets the path of the current print(destination_folder) # Check if the destination folder exists and remove it if it does # if not os.path.exists(destination_folder): os.makedirs(destination_folder,exist_ok=True) # Copy the source folder to the destination copy_tree(source_folder, destination_folder) shutil.copy("./my_number_temp/prepare.sh", f"{os.getcwd()}") _ = subprocess.run(['bash', "./prepare.sh"], capture_output=True, text=True) import time import streamlit as st from query_builder import query_suggestion # Streamlit app interface def main(): st.title("Query Suggestion") user_input = st.text_area("Enter your request:", height=100) if st.button("Submit"): # Record start time start_time = time.time() result = query_suggestion(user_input) # Record end time end_time = time.time() processing_time_ms = (end_time - start_time) * 1000 # Display the results st.subheader("Query suggests for you:") for i, item in enumerate(result, 1): st.write(f"{i}. {item}") # Display processing time st.write(f"Processing Time: {processing_time_ms:.2f} ms") if __name__ == "__main__": main()