From c779fb9aa61ec48953760c8c6269b625da6360d2 Mon Sep 17 00:00:00 2001 From: Alexandra Date: Mon, 29 Jul 2024 12:56:01 +0300 Subject: [PATCH] Service is ready --- annotators/vidchapters_service/Dockerfile | 3 +++ annotators/vidchapters_service/server.py | 7 +++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/annotators/vidchapters_service/Dockerfile b/annotators/vidchapters_service/Dockerfile index f0cef695a..211a9c3cf 100644 --- a/annotators/vidchapters_service/Dockerfile +++ b/annotators/vidchapters_service/Dockerfile @@ -16,6 +16,9 @@ RUN touch /src/__init__.py && \ RUN sed -in '/args.model_name = os.path.join(os.environ\[\"TRANSFORMERS_CACHE\"\], args.model_name)/d' /src/aux_files/VidChapters/demo_vid2seq.py RUN sed -i "s/t5-base/google-t5\/t5-base/" /src/aux_files/VidChapters/args.py RUN sed -i "s/local_files_only=True/local_files_only=False/" /src/aux_files/VidChapters/model/vid2seq.py +RUN sed -i "s/print(/#print(/" /src/aux_files/VidChapters/demo_vid2seq.py +RUN sed -i "s/#print(res)/print(res)/" /src/aux_files/VidChapters/demo_vid2seq.py + RUN wget -O /src/aux_files/checkpoint_vidchapters https://drive.google.com/file/d/1jbmfuB44p3twrlqnfIv6cCM3Oyqk-zeh RUN gdown --fuzzy https://drive.google.com/file/d/1qmQcEkDDlnkAkRd6BIrVoArBv6Sg1Lv7/view -O /src/aux_files/captioning_model.pth -c --no-check-certificate diff --git a/annotators/vidchapters_service/server.py b/annotators/vidchapters_service/server.py index 842aadd7e..d3f555e8e 100644 --- a/annotators/vidchapters_service/server.py +++ b/annotators/vidchapters_service/server.py @@ -315,11 +315,10 @@ def gen_video_caption(video_path, asr_caption): ] try: result = subprocess.run(command, capture_output=True, text=True) - logger.info(result.stdout) - logger.info(result.stderr) + # logger.info(result.stdout) except Exception as e: logger.warn(f"str{e}, {type(e)=}") - return "this is fine" + return result.stdout @app.route("/respond", methods=["POST"]) def respond(): @@ -360,7 +359,7 @@ def respond(): asr_output_path = os.path.join(DATA_DIR, i.split(".")[0]+'_asr') video_path = os.path.join(DATA_DIR, i) asr_caption = generate_asr(video_path, asr_output_path) - logger.info(asr_caption) + logger.info("ASR caption is ready. Video chapters in processing.") # video_caption = generate_video_caption(video_path, asr_caption) video_caption = gen_video_caption(video_path, asr_caption) logger.info("Inference finished successfully")