Spaces:
Running
A newer version of the Streamlit SDK is available: 1.56.0
🚀 How to Deploy VLM Caption Lab to Hugging Face Spaces
Since this project requires heavy Machine Learning models (BLIP, ViT-GPT2), the best way to share it with your mentor or reviewers is by deploying it for free on Hugging Face Spaces. They can use the app instantly in their browser without installing anything.
Here are the step-by-step instructions to deploy it right now.
Step 1: Create a Hugging Face Space
- Go to huggingface.co/spaces and create a free account (or log in).
- Click Create new Space.
- Fill out the form:
- Space name:
vlm-caption-lab(or whatever you like) - License: Choose
MITorCreative Commons - Select the Space SDK: Click Streamlit
- Space hardware: Choose the Free (CPU basic) option.
- Space name:
- Click Create Space.
Step 2: Upload Your Code using the Web UI
The easiest way is to drag and drop your files.
- In your new Space, click on the Files tab.
- Click Add file > Upload files.
- Select and upload the following files from your local
project_02folder:app.pyconfig.pydata_prep.pyeval.pyrequirements.txtinput.txtshakespeare_transformer.pt
- Also, recreate the
configs/,models/, andexperiments/folders in the Hugging Face UI and upload the python files inside them. (Or, if you know Git, justgit pushyour whole repository to the Space!)
Step 3: Handle the Large outputs/ Folder (Fine-tuned Weights)
Your outputs/ folder is 2.4 GB. You must upload this using Git LFS (Large File Storage), or host it as a Hugging Face Dataset and download it on the fly.
To keep it simple under a time crunch:
- Go to Settings in your Space.
- Scroll to Variables and secrets.
- Your app will run using base weights automatically. The mentor will be able to test the architectures immediately.
- If you absolutely need them to test your fine-tuned best weights, simply upload your
outputs/custom_vlm/best/custom_vlm.ptfile manually via the Files tab (it's small enough!). You can skip the massive ViT-GPT2 weights.
Step 4: Watch it Build
Once your files (especially app.py and requirements.txt) are uploaded, Hugging Face will automatically detect it's a Streamlit app.
- Click the App tab.
- You will see a "Building" log. It will take ~2-3 minutes to install PyTorch and download the model weights into its cache.
- Once the status turns green to Running, your app is live!
Step 5: Share the Link!
Just copy the URL from your browser (e.g., https://huggingface.co/spaces/your-username/vlm-caption-lab) and send it to your mentor. You're done!