Skip to content

Commit

Permalink
Service is ready
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexandra committed Jul 29, 2024
1 parent fb3096d commit c779fb9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 3 additions & 0 deletions annotators/vidchapters_service/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 3 additions & 4 deletions annotators/vidchapters_service/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit c779fb9

Please sign in to comment.