Skip to content

Commit

Permalink
up exec.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
ofilangi committed Oct 8, 2024
1 parent 3b3a4d9 commit 7e61b7a
Showing 1 changed file with 27 additions and 8 deletions.
35 changes: 27 additions & 8 deletions exec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,19 @@ if [ "$#" -ne 1 ]; then
fi

conffile="$1"
venv_name="llm_semantic_annotator_env"

# Fonction pour créer l'environnement virtuel s'il n'existe pas
create_venv_if_not_exists() {
if [ ! -d "$venv_name" ]; then
echo "Creating virtual environment..."
python3 -m venv "$venv_name"
source "$venv_name/bin/activate"
pip install -r requirements.txt # Assurez-vous d'avoir un fichier requirements.txt
else
source "$venv_name/bin/activate"
fi
}

run_command() {
"$@"
Expand All @@ -18,14 +31,17 @@ run_command() {

execute_command() {
case $1 in
1) run_command python -m llm_semantic_annotator "$conffile" populate_owl_tag_embeddings ;;
2) run_command python -m llm_semantic_annotator "$conffile" populate_ncbi_taxon_tag_embeddings ;;
3) run_command python -m llm_semantic_annotator "$conffile" populate_abstract_embeddings ;;
4) run_command python -m llm_semantic_annotator "$conffile" compute_tag_chunk_similarities ;;
1) run_command python3 -m llm_semantic_annotator "$conffile" populate_owl_tag_embeddings ;;
2) run_command python3 -m llm_semantic_annotator "$conffile" populate_ncbi_taxon_tag_embeddings ;;
3) run_command python3 -m llm_semantic_annotator "$conffile" populate_abstract_embeddings ;;
4) run_command python3 -m llm_semantic_annotator "$conffile" compute_tag_chunk_similarities ;;
*) echo "Invalid option" ;;
esac
}

# Créer l'environnement virtuel s'il n'existe pas
create_venv_if_not_exists

echo "What would you like to execute?"
echo "1. Full workflow"
echo "2. populate_owl_tag_embeddings"
Expand All @@ -36,10 +52,10 @@ read -p "Enter your choice (1-5): " choice

case $choice in
1)
run_command python -m llm_semantic_annotator "$conffile" populate_owl_tag_embeddings
run_command python -m llm_semantic_annotator "$conffile" populate_ncbi_taxon_tag_embeddings
run_command python -m llm_semantic_annotator "$conffile" populate_abstract_embeddings
run_command python -m llm_semantic_annotator "$conffile" compute_tag_chunk_similarities
run_command python3 -m llm_semantic_annotator "$conffile" populate_owl_tag_embeddings
run_command python3 -m llm_semantic_annotator "$conffile" populate_ncbi_taxon_tag_embeddings
run_command python3 -m llm_semantic_annotator "$conffile" populate_abstract_embeddings
run_command python3 -m llm_semantic_annotator "$conffile" compute_tag_chunk_similarities
;;
2|3|4|5)
execute_command $((choice - 1))
Expand All @@ -49,3 +65,6 @@ case $choice in
exit 1
;;
esac

# Désactiver l'environnement virtuel à la fin
deactivate

0 comments on commit 7e61b7a

Please sign in to comment.