--- 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** ```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 `Space` metadata (`.huggingface.yaml`) - progress bars / image preview UI --- ## **.huggingface.yaml** (Space Metadata) ```yaml # 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. ```text (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`. ```python 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