A newer version of the Gradio SDK is available: 6.25.0
title: Database Image Alt-Text Generator
emoji: 🖼️
colorFrom: blue
colorTo: purple
sdk: gradio
app_file: app.py
pinned: false
Database Image Alt-Text Generator
This Gradio Space accepts a CSV, TSV, XLSX, or XLSM table with one encoded image per row, generates alt text with a Hugging Face vision-language model, and returns the original table with added result columns.
Supported image-cell representations
TFLiveDataheader followed by original image bytes- Base64
- Hexadecimal
- Escaped byte strings such as
\\x89PNG... - Latin-1-preserved binary strings
- Python byte literals such as
b'...'
The supplied example has this form:
<TFLiveData extension=".ico" name="FileCabinet.ico" mime="image/x-icon" stamp="...">[ICO bytes]
The app removes the metadata header, opens the remaining bytes with Pillow, and converts the result to PNG before inference.
Deploy on Hugging Face Spaces
- Create a new Gradio Space.
- Upload
app.py,requirements.txt, and thisREADME.mdto the Space repository. - Create a Hugging Face access token with Inference Providers permission.
- In the Space settings, add a private repository secret named
HF_TOKEN. - Keep the default model or set the optional
VISION_MODELrepository variable. - For confidential database images, make the Space private and confirm that the selected inference provider is approved by your organization.
Recommended database export format
Base64 is the safest representation for CSV and Excel because arbitrary binary bytes, NUL characters, tabs, and line breaks can corrupt delimited files. If possible, export each image field as base64 while retaining a record ID and MIME-type column.
Suggested input:
| image_id | image_data | mime_type |
|---|---|---|
| 1001 | AAABAAE... |
image/x-icon |
Output columns
record_idalt_textstatuserrorsource_namesource_mimeprocessed_dimensions
Rows that fail decoding or inference remain in the output and receive status = error with a diagnostic message.