From acf0d9e9e2e4dc39c4751d224ca3462dedb881d3 Mon Sep 17 00:00:00 2001 From: Gokul Mohanarangan Date: Mon, 10 Jul 2023 20:13:58 +0530 Subject: [PATCH] push folder restructuring --- scripts/clear_artefacts.sh | 15 +++++++++++++++ .../setup_dependencies.sh | 2 +- server_executor_cleaned.py | 2 +- utils/viz_utilities.py | 6 +++--- whisjax.py | 4 ++-- 5 files changed, 22 insertions(+), 7 deletions(-) create mode 100755 scripts/clear_artefacts.sh rename setup_dependencies.sh => scripts/setup_dependencies.sh (94%) diff --git a/scripts/clear_artefacts.sh b/scripts/clear_artefacts.sh new file mode 100755 index 00000000..b179154c --- /dev/null +++ b/scripts/clear_artefacts.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# Directory to search for Python files +directory="." + +# Pattern to match Python files (e.g., "*.py" for all .py files) +text_file_pattern="transcript_*.txt" +pickle_file_pattern="*.pkl" +html_file_pattern="*.html" +png_file_pattern="*.png" + +find "$directory" -type f -name "$text_file_pattern" -delete +find "$directory" -type f -name "$pickle_file_pattern" -delete +find "$directory" -type f -name "$html_file_pattern" -delete +find "$directory" -type f -name "$png_file_pattern" -delete diff --git a/setup_dependencies.sh b/scripts/setup_dependencies.sh similarity index 94% rename from setup_dependencies.sh rename to scripts/setup_dependencies.sh index dab656a7..b7dc6d77 100755 --- a/setup_dependencies.sh +++ b/scripts/setup_dependencies.sh @@ -26,7 +26,7 @@ pip install git+https://github.com/sanchit-gandhi/whisper-jax.git # Update to latest version pip install --upgrade --no-deps --force-reinstall git+https://github.com/sanchit-gandhi/whisper-jax.git -pip install -r requirements.txt +pip install -r ../requirements.txt # download spacy models spacy download en_core_web_sm diff --git a/server_executor_cleaned.py b/server_executor_cleaned.py index cb428398..ca42a1b0 100644 --- a/server_executor_cleaned.py +++ b/server_executor_cleaned.py @@ -15,7 +15,7 @@ from aiortc.contrib.media import MediaRelay from av import AudioFifo from whisper_jax import FlaxWhisperPipline -from reflector.utils.server_utils import run_in_executor +from utils.server_utils import run_in_executor logger = logging.getLogger(__name__) diff --git a/utils/viz_utilities.py b/utils/viz_utilities.py index ed13d6c7..94e774c6 100644 --- a/utils/viz_utilities.py +++ b/utils/viz_utilities.py @@ -30,7 +30,7 @@ def create_wordcloud(timestamp, real_time=False): else: filename += "_" + timestamp.strftime("%m-%d-%Y_%H:%M:%S") + ".txt" - with open(filename, "r") as f: + with open("./artefacts/" + filename, "r") as f: transcription_text = f.read() # python_mask = np.array(PIL.Image.open("download1.png")) @@ -199,6 +199,6 @@ def create_talk_diff_scatter_viz(timestamp, real_time=False): transform=st.Scalers.dense_rank ) if real_time: - open('./real_time_scatter_' + timestamp.strftime("%m-%d-%Y_%H:%M:%S") + '.html', 'w').write(html) + open('./artefacts/real_time_scatter_' + timestamp.strftime("%m-%d-%Y_%H:%M:%S") + '.html', 'w').write(html) else: - open('./scatter_' + timestamp.strftime("%m-%d-%Y_%H:%M:%S") + '.html', 'w').write(html) \ No newline at end of file + open('./artefacts/scatter_' + timestamp.strftime("%m-%d-%Y_%H:%M:%S") + '.html', 'w').write(html) \ No newline at end of file diff --git a/whisjax.py b/whisjax.py index c78eaec3..bee4b6d8 100644 --- a/whisjax.py +++ b/whisjax.py @@ -137,10 +137,10 @@ def main(): for chunk in whisper_result["chunks"]: transcript_text += chunk["text"] - with open("transcript_" + NOW.strftime("%m-%d-%Y_%H:%M:%S") + ".txt", "w") as transcript_file: + with open("./artefacts/transcript_" + NOW.strftime("%m-%d-%Y_%H:%M:%S") + ".txt", "w") as transcript_file: transcript_file.write(transcript_text) - with open("transcript_with_timestamp_" + NOW.strftime("%m-%d-%Y_%H:%M:%S") + ".txt", "w") as transcript_file_timestamps: + with open("./artefacts/transcript_with_timestamp_" + NOW.strftime("%m-%d-%Y_%H:%M:%S") + ".txt", "w") as transcript_file_timestamps: transcript_file_timestamps.write(str(whisper_result))