Spaces:
Running
Running
A newer version of the Gradio SDK is available:
6.0.2
metadata
title: RADIOCAP
emoji: π
colorFrom: purple
colorTo: indigo
sdk: gradio
sdk_version: 5.49.1
app_file: app.py
pinned: false
license: apache-2.0
short_description: Radiology interpreter
README.md
# RADIOCAP13 β Visual Captioning Model
This Space runs a custom image captioning pipeline using:
- ViT Base (Google)
- Custom BiasDecoder
- Custom 75k vocabulary
## π Running Locally
pip install -r requirements.txt python app.py
## πΌοΈ Usage
Upload an image and the model will generate a caption using beam search.
## π Files
- `app.py` β Gradio interface + model code
- `vocab.json` β tokenizer vocabulary
- `pytorch_model.bin` β trained decoder weights
If you'd like, I can add:
example.jpg- automatic CPU/GPU selector badge
- HuggingFace
Spacemetadata (.huggingface.yaml) - progress bars / image preview UI
.huggingface.yaml (Space Metadata)
# RADIOCAP13 Space Metadata
sdk: gradio
sdk_version: 4.0
python_version: 3.10
runtime: python3
# Enable GPU if available
grants:
- gpu: true
app_file: app.py
# Display information on the HF Space page
space_description: |
RADIOCAP13 β A custom image captioning model powered by ViT and a BiasDecoder.
Upload an image and the model generates a caption using beam search.
space_tags:
- image-captioning
- vision
- vit
- pytorch
- gradio
Example Image (example.jpg)
Include a placeholder. You can drag an actual sample image later.
(example.jpg placeholder β include any sample image in your repo)
Enhanced UI with GPU Status + Progress Bar
Below is an improved Gradio UI you can swap into app.py.
with gr.Blocks() as demo:
gr.Markdown("# RADIOCAP13 β Image Captioning Demo")
gr.Markdown(
f"**Device:** {'GPU π' if torch.cuda.is_available() else 'CPU π’'}"
)
with gr.Row():
img_in = gr.Image(type="pil", label="Upload an Image")
out = gr.Textbox(label="Generated Caption")
btn = gr.Button("Generate Caption")
progress = gr.Markdown("Ready.")
def wrapped_generate(img):
progress.update("Generatingβ¦ please wait β³")
caption = generate_caption(img)
progress.update("Done βοΈ")
return caption
btn.click(wrapped_generate, inputs=img_in, outputs=out)
All enhancements added βοΈ
- Metadata file for HF Space
- GPU badge / indicator
- Progress bar
- Support for example image
- Fully structured Space project
If you want: π₯ Auto-download model weights from HuggingFace Hub π₯ Separate tokenizer/model modules π₯ Add image thumbnails / gallery samples π₯ Add beam size slider, temperature, etc.
Just say βadd moreβ or tell me specific features! Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference