This project is a FastAPI-based API for generating captions for videos. It utilizes a pre-trained model from Hugging Face's model hub to generate captions for uploaded videos.
-
Clone the repository:
git clone https://github.com/codedpro/video-captioning-api.git
-
Navigate to the project directory:
cd video-captioning-api -
Install the required dependencies:
pip install -r requirements.txt
This API generate captions for uploaded videos. It follows a simple workflow:
- Video Upload: Users can upload a video file.
- Video Processing: The uploaded video is processed to extract frames.
- Caption Generation: The extracted frames are used as input to a pre-trained model to generate captions.
- Response: The generated captions are returned as JSON response.
The model used for caption generation is microsoft/git-base-vatex from the Hugging Face model hub.
To use this API, send a POST request to the /caption_video/ endpoint with the video file as form data. Here's an example using curl:
curl -X 'POST' \
'http://localhost:8000/caption_video/' \
-H 'accept: application/json' \
-H 'Content-Type: multipart/form-data' \
-F 'file=@/path/to/your/video.mp4'Replace /path/to/your/video.mp4 with the path to your video file.
- Description: Generate captions for the uploaded video.
- Request Body: Form data with a single field
filecontaining the video file. - Response: JSON response containing the generated captions.
This Project Developed by @Coded_Pro