Triển khai inference cho mô hình image captioning bằng TensorFlow/Keras, với giao diện Gradio đơn giản cho upload ảnh và nhận caption.
Triển khai inference cho mô hình image captioning dùng TensorFlow/Keras, EfficientNetV2B0 và giao diện Gradio.
1.
2├── app.py # UI Gradio cho Hugging Face Space
3├── flickr30k.py # Logic model + tiền xử lý (đã cung cấp)
4├── best_model.keras # Trọng số mô hình (đặt cùng thư mục)
5├── tokenizer.pkl # Tokenizer đã fit
6├── model_config.pkl # Chứa max_length, vocab_size
7├── requirements.txt
8└── README.md
1python -m venv .venv
2. .venv/bin/activate # Windows: .venv\Scripts\activate
3pip install --upgrade pip
4pip install -r requirements.txt
5
6# Đảm bảo 3 tệp đã có:
7# best_model.keras, tokenizer.pkl, model_config.pkl
8
9python app.py
Mở URL Gradio hiển thị trong terminal.