File size: 2,885 Bytes
3fb11ac
 
 
 
 
 
 
 
 
 
 
 
98de3b6
 
 
3fb11ac
98de3b6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3fb11ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
---
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