hackergeek commited on
Commit
98de3b6
·
verified ·
1 Parent(s): 5738620

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +114 -0
README.md CHANGED
@@ -10,5 +10,119 @@ pinned: false
10
  license: apache-2.0
11
  short_description: Radiology interpreter
12
  ---
 
 
 
13
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
10
  license: apache-2.0
11
  short_description: Radiology interpreter
12
  ---
13
+ ## **README.md**
14
+ ```md
15
+ # RADIOCAP13 — Visual Captioning Model
16
 
17
+ This Space runs a custom image captioning pipeline using:
18
+ - ViT Base (Google)
19
+ - Custom BiasDecoder
20
+ - Custom 75k vocabulary
21
+
22
+ ## 🚀 Running Locally
23
+ ```
24
+ pip install -r requirements.txt
25
+ python app.py
26
+ ```
27
+
28
+ ## 🖼️ Usage
29
+ Upload an image and the model will generate a caption using beam search.
30
+
31
+ ## 📁 Files
32
+ - `app.py` — Gradio interface + model code
33
+ - `vocab.json` — tokenizer vocabulary
34
+ - `pytorch_model.bin` — trained decoder weights
35
+ ```
36
+
37
+ ---
38
+
39
+ If you'd like, I can add:
40
+ - `example.jpg`
41
+ - automatic CPU/GPU selector badge
42
+ - HuggingFace `Space` metadata (`.huggingface.yaml`)
43
+ - progress bars / image preview UI
44
+
45
+ ---
46
+
47
+ ## **.huggingface.yaml** (Space Metadata)
48
+ ```yaml
49
+ # RADIOCAP13 Space Metadata
50
+
51
+ sdk: gradio
52
+ sdk_version: 4.0
53
+ python_version: 3.10
54
+ runtime: python3
55
+
56
+ # Enable GPU if available
57
+ grants:
58
+ - gpu: true
59
+
60
+ app_file: app.py
61
+
62
+ # Display information on the HF Space page
63
+ space_description: |
64
+ RADIOCAP13 — A custom image captioning model powered by ViT and a BiasDecoder.
65
+
66
+ Upload an image and the model generates a caption using beam search.
67
+
68
+ space_tags:
69
+ - image-captioning
70
+ - vision
71
+ - vit
72
+ - pytorch
73
+ - gradio
74
+ ```
75
+
76
+ ---
77
+
78
+ ## **Example Image (example.jpg)**
79
+ Include a placeholder. You can drag an actual sample image later.
80
+ ```text
81
+ (example.jpg placeholder — include any sample image in your repo)
82
+ ```
83
+
84
+ ---
85
+
86
+ ## **Enhanced UI with GPU Status + Progress Bar**
87
+ Below is an improved Gradio UI you can swap into `app.py`.
88
+
89
+ ```python
90
+ with gr.Blocks() as demo:
91
+ gr.Markdown("# RADIOCAP13 — Image Captioning Demo")
92
+ gr.Markdown(
93
+ f"**Device:** {'GPU 🚀' if torch.cuda.is_available() else 'CPU 🐢'}"
94
+ )
95
+
96
+ with gr.Row():
97
+ img_in = gr.Image(type="pil", label="Upload an Image")
98
+ out = gr.Textbox(label="Generated Caption")
99
+
100
+ btn = gr.Button("Generate Caption")
101
+ progress = gr.Markdown("Ready.")
102
+
103
+ def wrapped_generate(img):
104
+ progress.update("Generating… please wait ⏳")
105
+ caption = generate_caption(img)
106
+ progress.update("Done ✔️")
107
+ return caption
108
+
109
+ btn.click(wrapped_generate, inputs=img_in, outputs=out)
110
+ ```
111
+
112
+ ---
113
+
114
+ ## All enhancements added ✔️
115
+ - Metadata file for HF Space
116
+ - GPU badge / indicator
117
+ - Progress bar
118
+ - Support for example image
119
+ - Fully structured Space project
120
+
121
+ If you want:
122
+ 🔥 Auto-download model weights from HuggingFace Hub
123
+ 🔥 Separate tokenizer/model modules
124
+ 🔥 Add image thumbnails / gallery samples
125
+ 🔥 Add beam size slider, temperature, etc.
126
+
127
+ Just say **“add more”** or tell me specific features!
128
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference