From 599d9561416d0ddc499cb232dadd08c24ff90c56 Mon Sep 17 00:00:00 2001 From: Sudeep Ratnaparkhe Date: Fri, 15 Mar 2024 12:25:58 +0530 Subject: [PATCH 01/12] Added docker compose file --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index eedecc2..805cd4c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,5 +3,5 @@ services: ALL-TEXT_EVAL: image: all-text-eval-app ports: - - '5001:5001' + - '0.0.0.0:5000:5000' restart: always From 17f60189224f6f0525ba194e3208f3f0692c64fd Mon Sep 17 00:00:00 2001 From: Sudeep Ratnaparkhe Date: Fri, 15 Mar 2024 12:30:10 +0530 Subject: [PATCH 02/12] added network in docker compose file --- docker-compose.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 805cd4c..4f0a712 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,3 +5,7 @@ services: ports: - '0.0.0.0:5000:5000' restart: always + +networks: + ai-network: + driver: bridge From badb488a4f1ea6530ddb1be34cb5c849e53adfb6 Mon Sep 17 00:00:00 2001 From: prasadharke-tekdi <131845849+prasadharke-tekdi@users.noreply.github.com> Date: Fri, 15 Mar 2024 14:15:01 +0530 Subject: [PATCH 03/12] Create dev.yml --- .github/workflows/dev.yml | 62 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 .github/workflows/dev.yml diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml new file mode 100644 index 0000000..5d5eeac --- /dev/null +++ b/.github/workflows/dev.yml @@ -0,0 +1,62 @@ +name: DEV DEPLOYMENT + +on: + push: + branches: [ all-1.0 ] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v2 + - + name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - + name: Load .env from GitHub Secret + run: echo "${{ secrets.MY_ENV_VARS }}" > .env + + - + name: Build and push + uses: docker/build-push-action@v2 + with: + context: . + push: true + tags: ${{ secrets.CONTAINER_REGISTRY }}:${{ secrets.IMAGE_TAG }} + env: + MY_ENV_VARS: ${{ secrets.MY_ENV_VARS }} + deploy: + runs-on: ubuntu-latest + timeout-minutes: 15 + needs: [build] + steps: + - + name: Checkout + uses: actions/checkout@v2 + - + name: Deploy Stack + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.HOST }} + username: ${{ secrets.USERNAME }} + key: ${{ secrets.SSH_PRIVATE_KEY }} + port: ${{ secrets.PORT }} + script: | + + docker login + + docker container stop ${{ secrets.CONTAINER_NAME }} + + docker rm ${{ secrets.CONTAINER_NAME }} + + docker rmi ${{ secrets.CONTAINER_REGISTRY }}:${{ secrets.IMAGE_TAG }} + + docker pull ${{ secrets.CONTAINER_REGISTRY }}:${{ secrets.IMAGE_TAG }} + + docker run -d --name ${{ secrets.CONTAINER_NAME }} --network ${{ secrets.NETWORK }} -p ${{ secrets.CONTAINER_PORT }} -t ${{ secrets.CONTAINER_REGISTRY }}:${{ secrets.IMAGE_TAG }} From 574d4e518240af2735b060f26d900fee0056784f Mon Sep 17 00:00:00 2001 From: prasadharke-tekdi <131845849+prasadharke-tekdi@users.noreply.github.com> Date: Sat, 16 Mar 2024 15:07:46 +0530 Subject: [PATCH 04/12] Update Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 73c1305..99410bb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,7 +21,7 @@ RUN pip install -r requirements.txt COPY . . # Expose the port that the app runs on -EXPOSE 5000 +EXPOSE 5001 # Command to run the Flask application CMD ["python", "app.py","--host","0.0.0.0"] From 41dc0349639c8b26025c8c20de750ca08a39f9f9 Mon Sep 17 00:00:00 2001 From: prasadharke-tekdi <131845849+prasadharke-tekdi@users.noreply.github.com> Date: Sat, 16 Mar 2024 15:22:40 +0530 Subject: [PATCH 05/12] Update Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 99410bb..0d6670b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,7 +21,7 @@ RUN pip install -r requirements.txt COPY . . # Expose the port that the app runs on -EXPOSE 5001 +EXPOSE $PORT # Command to run the Flask application CMD ["python", "app.py","--host","0.0.0.0"] From 2d7297139d5b29643d8267148afe1dc488d0b53c Mon Sep 17 00:00:00 2001 From: prasadharke-tekdi <131845849+prasadharke-tekdi@users.noreply.github.com> Date: Mon, 18 Mar 2024 18:27:55 +0530 Subject: [PATCH 06/12] Create Prod.yml --- .github/workflows/Prod.yml | 60 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 .github/workflows/Prod.yml diff --git a/.github/workflows/Prod.yml b/.github/workflows/Prod.yml new file mode 100644 index 0000000..b8066aa --- /dev/null +++ b/.github/workflows/Prod.yml @@ -0,0 +1,60 @@ +name: PROD DEPLOYMENT + +on: + push: + branches: [ all-1.0-prod ] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v2 + - + name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - + name: Load .env from GitHub Secret + run: echo "${{ secrets.MY_ENV_VARS_PROD }}" > .env + + - + name: Build and push + uses: docker/build-push-action@v2 + with: + context: . + push: true + tags: ${{ secrets.CONTAINER_REGISTRY_PROD }}:${{ secrets.IMAGE_TAG }} + env: + MY_ENV_VARS: ${{ secrets.MY_ENV_VARS_PROD }} + deploy: + runs-on: ubuntu-latest + timeout-minutes: 15 + needs: [build] + steps: + - + name: Checkout + uses: actions/checkout@v2 + - + name: Deploy Stack + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.HOST_PROD }} + username: ${{ secrets.USERNAME_PROD }} + key: ${{ secrets.SSH_PRIVATE_KEY_PROD }} + port: ${{ secrets.PORT }} + script: | + + docker login + + docker container stop ${{ secrets.CONTAINER_NAME }} + + docker rm ${{ secrets.CONTAINER_NAME }} + docker rmi ${{ secrets.CONTAINER_REGISTRY_PROD }}:${{ secrets.IMAGE_TAG }} + docker pull ${{ secrets.CONTAINER_REGISTRY_PROD }}:${{ secrets.IMAGE_TAG }} + + docker run -d --name ${{ secrets.CONTAINER_NAME }} --network ${{ secrets.NETWORK }} -p ${{ secrets.CONTAINER_PORT }} -t ${{ secrets.CONTAINER_REGISTRY_PROD }}:${{ secrets.IMAGE_TAG }} From cba46cedf7c75afe20343f7809b94e4993922fea Mon Sep 17 00:00:00 2001 From: prasadharke-tekdi <131845849+prasadharke-tekdi@users.noreply.github.com> Date: Mon, 18 Mar 2024 18:28:37 +0530 Subject: [PATCH 07/12] Create Prod.yml --- .github/workflows/Prod.yml | 60 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 .github/workflows/Prod.yml diff --git a/.github/workflows/Prod.yml b/.github/workflows/Prod.yml new file mode 100644 index 0000000..b8066aa --- /dev/null +++ b/.github/workflows/Prod.yml @@ -0,0 +1,60 @@ +name: PROD DEPLOYMENT + +on: + push: + branches: [ all-1.0-prod ] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v2 + - + name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - + name: Load .env from GitHub Secret + run: echo "${{ secrets.MY_ENV_VARS_PROD }}" > .env + + - + name: Build and push + uses: docker/build-push-action@v2 + with: + context: . + push: true + tags: ${{ secrets.CONTAINER_REGISTRY_PROD }}:${{ secrets.IMAGE_TAG }} + env: + MY_ENV_VARS: ${{ secrets.MY_ENV_VARS_PROD }} + deploy: + runs-on: ubuntu-latest + timeout-minutes: 15 + needs: [build] + steps: + - + name: Checkout + uses: actions/checkout@v2 + - + name: Deploy Stack + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.HOST_PROD }} + username: ${{ secrets.USERNAME_PROD }} + key: ${{ secrets.SSH_PRIVATE_KEY_PROD }} + port: ${{ secrets.PORT }} + script: | + + docker login + + docker container stop ${{ secrets.CONTAINER_NAME }} + + docker rm ${{ secrets.CONTAINER_NAME }} + docker rmi ${{ secrets.CONTAINER_REGISTRY_PROD }}:${{ secrets.IMAGE_TAG }} + docker pull ${{ secrets.CONTAINER_REGISTRY_PROD }}:${{ secrets.IMAGE_TAG }} + + docker run -d --name ${{ secrets.CONTAINER_NAME }} --network ${{ secrets.NETWORK }} -p ${{ secrets.CONTAINER_PORT }} -t ${{ secrets.CONTAINER_REGISTRY_PROD }}:${{ secrets.IMAGE_TAG }} From f037216e66e947a1e28d35975ed71b25ef476a56 Mon Sep 17 00:00:00 2001 From: prasadharke-tekdi <131845849+prasadharke-tekdi@users.noreply.github.com> Date: Mon, 18 Mar 2024 18:32:49 +0530 Subject: [PATCH 08/12] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f480903..03d28a5 100644 --- a/README.md +++ b/README.md @@ -1 +1 @@ -# all-learner-text-eval +# all-learner-text-eval. From 96f8f47f13b230a3bdcfaf57e3b10b02d7d50ba0 Mon Sep 17 00:00:00 2001 From: Sudeep Ratnaparkhe Date: Mon, 8 Apr 2024 01:09:04 +0530 Subject: [PATCH 09/12] Changes for english phonemes identification as missing, confidence properly and remove unique list making for phonemes --- app.py | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/app.py b/app.py index b6d7d3f..26588ae 100644 --- a/app.py +++ b/app.py @@ -218,6 +218,8 @@ def split_into_phonemes(token): return ph_list def identify_missing_tokens(orig_text, resp_text): + if resp_text == None: + resp_text = "" orig_word_list = orig_text.split() resp_word_list = resp_text.split() construct_word_list =[] @@ -230,10 +232,10 @@ def identify_missing_tokens(orig_text, resp_text): for word in orig_word_list: #use similarity algo euclidean distance and add them, if there is no direct match closest_match, similarity_score = find_closest_match(word, resp_text) - #print(f"word:{word}: closest match: {closest_match}: sim score:{similarity_score}") + print(f"word:{word}: closest match: {closest_match}: sim score:{similarity_score}") p_word = p.convert(word) print(f"word - {word}:: phonemes - {p_word}")#p_word = split_into_phonemes(p_word) - if similarity_score > 80: + if closest_match != None and (similarity_score > 80 or len(orig_word_list) == 1): #print("matched word") construct_word_list.append(closest_match) p_closest_match = p.convert(closest_match) @@ -256,6 +258,16 @@ def identify_missing_tokens(orig_text, resp_text): missing_flatList = list(set(missing_flatList)) construct_flatList = list(set(construct_flatList)) + #For words like pew and few, we are adding to construct word and + # we just need to eliminate the matching phonemes and + # add missing phonemes into missing list + for m in orig_flatList: + print(m, " in construct phonemelist") + if m not in construct_flatList: + missing_flatList.append(m) + print('adding to missing list', m) + missing_flatList = list(set(missing_flatList)) + print(f"orig Text: {orig_text}") print(f"Resp Text: {resp_text}") print(f"construct Text: {construct_text}") @@ -265,8 +277,8 @@ def identify_missing_tokens(orig_text, resp_text): print(f"Construct phonemes: {construct_phoneme_list}") #print(f"flat Construct phonemes: {construct_flatList}") - print(f"missing phonemes: {missing_phoneme_list}") - #print(f"flat missing phonemes: {missing_flatList}") + #print(f"missing phonemes: {missing_phoneme_list}") + print(f"flat missing phonemes: {missing_flatList}") return construct_flatList, missing_flatList,construct_text def processLP(orig_text, resp_text): @@ -331,10 +343,9 @@ def get_phonemes(): text = data.get('text') phonemesList = split_into_phonemes(p.convert(text)) - uniquePhonemesList = list(dict.fromkeys(phonemesList)) return jsonify({ - "phonemes": uniquePhonemesList + "phonemes": phonemesList }) if __name__ == '__main__': From 3692099cf8658336e21933eeecc5c264de12d44e Mon Sep 17 00:00:00 2001 From: Sudeep Ratnaparkhe Date: Thu, 18 Apr 2024 11:32:32 +0530 Subject: [PATCH 10/12] updated prod yaml github workflow file to keep as same prod branch --- .github/workflows/Prod.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/Prod.yml b/.github/workflows/Prod.yml index b8066aa..42377c4 100644 --- a/.github/workflows/Prod.yml +++ b/.github/workflows/Prod.yml @@ -17,11 +17,11 @@ jobs: with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - + - name: Load .env from GitHub Secret run: echo "${{ secrets.MY_ENV_VARS_PROD }}" > .env - + - name: Build and push uses: docker/build-push-action@v2 @@ -30,7 +30,7 @@ jobs: push: true tags: ${{ secrets.CONTAINER_REGISTRY_PROD }}:${{ secrets.IMAGE_TAG }} env: - MY_ENV_VARS: ${{ secrets.MY_ENV_VARS_PROD }} + MY_ENV_VARS: ${{ secrets.MY_ENV_VARS_PROD }} deploy: runs-on: ubuntu-latest timeout-minutes: 15 @@ -39,7 +39,7 @@ jobs: - name: Checkout uses: actions/checkout@v2 - - + - name: Deploy Stack uses: appleboy/ssh-action@master with: @@ -48,13 +48,13 @@ jobs: key: ${{ secrets.SSH_PRIVATE_KEY_PROD }} port: ${{ secrets.PORT }} script: | - + docker login - + docker container stop ${{ secrets.CONTAINER_NAME }} - + docker rm ${{ secrets.CONTAINER_NAME }} docker rmi ${{ secrets.CONTAINER_REGISTRY_PROD }}:${{ secrets.IMAGE_TAG }} docker pull ${{ secrets.CONTAINER_REGISTRY_PROD }}:${{ secrets.IMAGE_TAG }} - + docker run -d --name ${{ secrets.CONTAINER_NAME }} --network ${{ secrets.NETWORK }} -p ${{ secrets.CONTAINER_PORT }} -t ${{ secrets.CONTAINER_REGISTRY_PROD }}:${{ secrets.IMAGE_TAG }} From 1b8a8bdef18c9121b3826c45956a7cb78a49b58f Mon Sep 17 00:00:00 2001 From: prasadharke-tekdi <131845849+prasadharke-tekdi@users.noreply.github.com> Date: Tue, 23 Apr 2024 10:18:53 +0530 Subject: [PATCH 11/12] Update Prod.yml --- .github/workflows/Prod.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Prod.yml b/.github/workflows/Prod.yml index 42377c4..1e702aa 100644 --- a/.github/workflows/Prod.yml +++ b/.github/workflows/Prod.yml @@ -57,4 +57,4 @@ jobs: docker rmi ${{ secrets.CONTAINER_REGISTRY_PROD }}:${{ secrets.IMAGE_TAG }} docker pull ${{ secrets.CONTAINER_REGISTRY_PROD }}:${{ secrets.IMAGE_TAG }} - docker run -d --name ${{ secrets.CONTAINER_NAME }} --network ${{ secrets.NETWORK }} -p ${{ secrets.CONTAINER_PORT }} -t ${{ secrets.CONTAINER_REGISTRY_PROD }}:${{ secrets.IMAGE_TAG }} + docker run -d --name ${{ secrets.CONTAINER_NAME }} --network ${{ secrets.NETWORK }} -p ${{ secrets.CONTAINER_PORT }} -t ${{ secrets.CONTAINER_REGISTRY_PROD }}:${{ secrets.IMAGE_TAG }} restart:always From ab6a667d8d3e808af1f8f59ad6b743a979130105 Mon Sep 17 00:00:00 2001 From: prasadharke-tekdi <131845849+prasadharke-tekdi@users.noreply.github.com> Date: Tue, 23 Apr 2024 10:21:32 +0530 Subject: [PATCH 12/12] Update Prod.yml --- .github/workflows/Prod.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Prod.yml b/.github/workflows/Prod.yml index 1e702aa..79b3920 100644 --- a/.github/workflows/Prod.yml +++ b/.github/workflows/Prod.yml @@ -57,4 +57,4 @@ jobs: docker rmi ${{ secrets.CONTAINER_REGISTRY_PROD }}:${{ secrets.IMAGE_TAG }} docker pull ${{ secrets.CONTAINER_REGISTRY_PROD }}:${{ secrets.IMAGE_TAG }} - docker run -d --name ${{ secrets.CONTAINER_NAME }} --network ${{ secrets.NETWORK }} -p ${{ secrets.CONTAINER_PORT }} -t ${{ secrets.CONTAINER_REGISTRY_PROD }}:${{ secrets.IMAGE_TAG }} restart:always + docker run -d --name ${{ secrets.CONTAINER_NAME }} --network ${{ secrets.NETWORK }} -p ${{ secrets.CONTAINER_PORT }} -t ${{ secrets.CONTAINER_REGISTRY_PROD }}:${{ secrets.IMAGE_TAG }}