@yeongjaeyou/claude-code-config 0.17.1 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/guidelines/work-guidelines.md +29 -0
- package/.claude/skills/gradio-cv-app/SKILL.md +170 -0
- package/.claude/skills/gradio-cv-app/references/github-references.md +134 -0
- package/.claude/skills/gradio-cv-app/references/i18n-patterns.md +416 -0
- package/.claude/skills/gradio-cv-app/references/refined-theme.md +403 -0
- package/.claude/skills/gradio-cv-app/references/task-templates.md +433 -0
- package/package.json +1 -1
|
@@ -156,6 +156,35 @@ When Built-in LSP returns "No LSP server available" error:
|
|
|
156
156
|
3. Prefer symbolic editing over file-based editing when modifying functions/classes
|
|
157
157
|
4. Always check `find_referencing_symbols` before renaming/removing symbols
|
|
158
158
|
|
|
159
|
+
### Self-Verification (MANDATORY)
|
|
160
|
+
|
|
161
|
+
#### Execution Requirement
|
|
162
|
+
- **MUST** execute code after writing, not just write and report
|
|
163
|
+
- For Python scripts: run with appropriate interpreter
|
|
164
|
+
- For tests: run pytest or equivalent
|
|
165
|
+
- For notebooks: execute cells via `mcp__ide__executeCode`
|
|
166
|
+
|
|
167
|
+
#### Error-Free Loop
|
|
168
|
+
1. Write code
|
|
169
|
+
2. Execute
|
|
170
|
+
3. Error? → Analyze → Fix → Re-execute
|
|
171
|
+
4. Repeat until success
|
|
172
|
+
5. Only then proceed or report
|
|
173
|
+
|
|
174
|
+
**NEVER:**
|
|
175
|
+
- Report "code written" without executing it
|
|
176
|
+
- Move to next step while errors exist
|
|
177
|
+
- Ask user to run code that you should verify yourself
|
|
178
|
+
|
|
179
|
+
#### Result Sanity Check
|
|
180
|
+
After successful execution, verify output makes sense:
|
|
181
|
+
- Data types/shapes as expected
|
|
182
|
+
- No unexpected NaN/None/empty values
|
|
183
|
+
- Numeric ranges reasonable
|
|
184
|
+
- Visualizations render correctly
|
|
185
|
+
|
|
186
|
+
If results look wrong → investigate and fix, don't just report the anomaly.
|
|
187
|
+
|
|
159
188
|
### Large File Handling
|
|
160
189
|
- Files exceeding 25000 tokens cannot be read at once (Claude Code internal limit)
|
|
161
190
|
- When encountering "exceeds maximum allowed tokens" error:
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: gradio-cv-app
|
|
3
|
+
description: Creates professional Gradio computer vision apps. Applies a refined Editorial design based on PRITHIVSAKTHIUR style. Automatically triggered for OCR, image classification, generation, segmentation, editing, captioning, and detection app requests. Used for Gradio CV apps, computer vision demos, and image processing app creation requests.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Gradio CV App Generator
|
|
7
|
+
|
|
8
|
+
A skill for creating professional Gradio computer vision apps.
|
|
9
|
+
Combines PRITHIVSAKTHIUR's functional patterns with Editorial design principles.
|
|
10
|
+
|
|
11
|
+
## Design Principles
|
|
12
|
+
|
|
13
|
+
### What to Avoid (AI Look)
|
|
14
|
+
- Purple/rainbow gradients
|
|
15
|
+
- Multiple mixed colors
|
|
16
|
+
- Excessive animations
|
|
17
|
+
- Colors commonly seen in AI demos like Steel Blue, Purple, etc.
|
|
18
|
+
|
|
19
|
+
### What to Apply (Editorial Style)
|
|
20
|
+
- Solid colors + single accent
|
|
21
|
+
- Pretendard font (Korean support)
|
|
22
|
+
- Minimal and functional UI
|
|
23
|
+
- Ample whitespace and high contrast
|
|
24
|
+
- Professional tool-like feel
|
|
25
|
+
- Dark mode support (system preference by default)
|
|
26
|
+
|
|
27
|
+
### Dark Mode Considerations
|
|
28
|
+
- **Accent color**: Must use `color_accent="*secondary_500"` (emerald) instead of default primary (zinc)
|
|
29
|
+
- Zinc primary causes poor tab text visibility in dark mode
|
|
30
|
+
- See [refined-theme.md](references/refined-theme.md) for complete theme settings
|
|
31
|
+
|
|
32
|
+
## Supported Task Types
|
|
33
|
+
|
|
34
|
+
| Task | Description | Key Patterns |
|
|
35
|
+
|------|-------------|--------------|
|
|
36
|
+
| `ocr` | OCR/VLM multimodal app | Tabs, TextIteratorStreamer, Accordion |
|
|
37
|
+
| `classify` | Image classification | gr.Interface, gr.Label |
|
|
38
|
+
| `generate` | Image generation | LoRA loading, style dictionary |
|
|
39
|
+
| `segment` | Segmentation | gr.AnnotatedImage |
|
|
40
|
+
| `edit` | Image editing | LoRA adapter, prompts |
|
|
41
|
+
| `caption` | Image captioning | VLM model, copy button |
|
|
42
|
+
| `detect` | Detection (Deepfake, etc.) | Binary classification, gr.Label |
|
|
43
|
+
|
|
44
|
+
## Usage
|
|
45
|
+
|
|
46
|
+
When creating a Gradio CV app:
|
|
47
|
+
|
|
48
|
+
1. **Identify task type**: Determine the CV task from the user request
|
|
49
|
+
2. **Apply theme**: Use the RefinedTheme class from [refined-theme.md](references/refined-theme.md)
|
|
50
|
+
3. **Reference templates**: Check the relevant task pattern in [task-templates.md](references/task-templates.md)
|
|
51
|
+
4. **Check reference repos**: Refer to [github-references.md](references/github-references.md) if needed
|
|
52
|
+
5. **Generate complete app.py**: Write ready-to-run code
|
|
53
|
+
|
|
54
|
+
## Theme Mode
|
|
55
|
+
|
|
56
|
+
Apps support light/dark mode with automatic system preference detection.
|
|
57
|
+
|
|
58
|
+
| Mode | Description |
|
|
59
|
+
|------|-------------|
|
|
60
|
+
| **Auto (Default)** | Detects OS preference, saves user choice to localStorage |
|
|
61
|
+
| Light | Forces light theme |
|
|
62
|
+
| Dark | Forces dark theme |
|
|
63
|
+
|
|
64
|
+
Implementation: Add theme toggle button using Lucide icons. See [refined-theme.md](references/refined-theme.md) for details.
|
|
65
|
+
|
|
66
|
+
## Internationalization (i18n)
|
|
67
|
+
|
|
68
|
+
Simple dictionary-based labels for Korean/English support.
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
LABELS = {
|
|
72
|
+
"en": {"title": "Image Classification", "run": "Run"},
|
|
73
|
+
"ko": {"title": "이미지 분류", "run": "실행"},
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
See [i18n-patterns.md](references/i18n-patterns.md) for full label dictionaries and usage patterns.
|
|
78
|
+
|
|
79
|
+
## Output Requirements
|
|
80
|
+
|
|
81
|
+
1. **Complete app.py file**: Ready-to-run code
|
|
82
|
+
2. **requirements.txt**: Required package list
|
|
83
|
+
- `gradio>=5.50.0,<6.0` (required version range)
|
|
84
|
+
- Other necessary packages
|
|
85
|
+
|
|
86
|
+
## Code Quality Standards
|
|
87
|
+
|
|
88
|
+
- Use type hints
|
|
89
|
+
- Error handling (use gr.Error)
|
|
90
|
+
- Memory management (torch.cuda.empty_cache())
|
|
91
|
+
- Apply inference mode when loading models (model.train(False))
|
|
92
|
+
- Appropriate comments
|
|
93
|
+
|
|
94
|
+
## Layout Best Practices
|
|
95
|
+
|
|
96
|
+
### Row/Column Nesting Rules
|
|
97
|
+
|
|
98
|
+
**CRITICAL**: Never nest `gr.Row` inside `gr.Row` - this causes double flex context conflicts.
|
|
99
|
+
|
|
100
|
+
| Pattern | Status | Reason |
|
|
101
|
+
|---------|--------|--------|
|
|
102
|
+
| `Row > Column > components` | CORRECT | Clear flex hierarchy |
|
|
103
|
+
| `Row > Row > components` | WRONG | Double flex context, alignment issues |
|
|
104
|
+
| `Column > Row > components` | CORRECT | Standard layout pattern |
|
|
105
|
+
|
|
106
|
+
**Example - Header Layout:**
|
|
107
|
+
|
|
108
|
+
```python
|
|
109
|
+
# CORRECT - Single Row level with direct children
|
|
110
|
+
with gr.Row(elem_id="header-row"):
|
|
111
|
+
gr.Image(...) # Direct child
|
|
112
|
+
gr.Markdown("# Title") # Direct child
|
|
113
|
+
gr.HTML(value=HEADER_CONTROLS_HTML) # Use gr.HTML for multiple controls
|
|
114
|
+
|
|
115
|
+
# WRONG - Nested Rows cause alignment issues
|
|
116
|
+
with gr.Row(elem_id="header-row"):
|
|
117
|
+
with gr.Row(elem_id="header-left"): # DO NOT DO THIS
|
|
118
|
+
gr.Image(...)
|
|
119
|
+
gr.Markdown(...)
|
|
120
|
+
with gr.Group(elem_id="header-controls"): # gr.Group forces column layout!
|
|
121
|
+
gr.HTML(...)
|
|
122
|
+
gr.HTML(...)
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Theme Toggle Implementation
|
|
126
|
+
|
|
127
|
+
**IMPORTANT**: In Gradio 5.x, `gr.Button` does NOT render HTML in the `value` parameter - it escapes HTML to text.
|
|
128
|
+
|
|
129
|
+
**For SVG Icons**: Use `gr.HTML` with native `<button>` element
|
|
130
|
+
**For Text Only**: Use `gr.Button` with text value (e.g., "Dark" / "Light")
|
|
131
|
+
|
|
132
|
+
```python
|
|
133
|
+
# CORRECT - gr.HTML for SVG icon toggle
|
|
134
|
+
THEME_TOGGLE_HTML = '''
|
|
135
|
+
<button id="theme-toggle" class="theme-toggle-btn" type="button">
|
|
136
|
+
<span class="icon-moon"><svg>...</svg></span>
|
|
137
|
+
<span class="icon-sun"><svg>...</svg></span>
|
|
138
|
+
</button>
|
|
139
|
+
'''
|
|
140
|
+
gr.HTML(value=THEME_TOGGLE_HTML)
|
|
141
|
+
|
|
142
|
+
# Click handler attached via demo.load() JS
|
|
143
|
+
demo.load(fn=None, js=INIT_THEME_JS) # Includes click handler
|
|
144
|
+
|
|
145
|
+
# WRONG - gr.Button does NOT render HTML
|
|
146
|
+
theme_btn = gr.Button(value="<span>...</span>") # Shows escaped text, not icon!
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### CSS Guidelines
|
|
150
|
+
|
|
151
|
+
| Practice | Status | Alternative |
|
|
152
|
+
|----------|--------|-------------|
|
|
153
|
+
| Use CSS variables | REQUIRED | `var(--body-text-color)` |
|
|
154
|
+
| Hardcoded hex colors | AVOID | Use theme variables |
|
|
155
|
+
| Excessive `!important` | AVOID | Let Gradio handle defaults |
|
|
156
|
+
| Manual flex layouts | MINIMIZE | Use `gr.Row`/`gr.Column` scale |
|
|
157
|
+
|
|
158
|
+
## Common Execution Pattern
|
|
159
|
+
|
|
160
|
+
```python
|
|
161
|
+
if __name__ == "__main__":
|
|
162
|
+
demo.queue(max_size=30).launch(mcp_server=True, ssr_mode=False, show_error=True)
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## Additional Resources
|
|
166
|
+
|
|
167
|
+
- Theme code (with dark mode): [references/refined-theme.md](references/refined-theme.md)
|
|
168
|
+
- Task-specific templates: [references/task-templates.md](references/task-templates.md)
|
|
169
|
+
- i18n patterns (Korean/English): [references/i18n-patterns.md](references/i18n-patterns.md)
|
|
170
|
+
- GitHub references: [references/github-references.md](references/github-references.md)
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# GitHub References
|
|
2
|
+
|
|
3
|
+
Reference repositories for Gradio CV applications by PRITHIVSAKTHIUR.
|
|
4
|
+
|
|
5
|
+
## Profile
|
|
6
|
+
|
|
7
|
+
- **GitHub**: https://github.com/PRITHIVSAKTHIUR
|
|
8
|
+
- **Hugging Face**: https://huggingface.co/prithivMLmods
|
|
9
|
+
- **Specialty**: Extensive experience building Gradio apps based on Computer Vision, VLM, and Diffusion models
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Reference Repositories by Task
|
|
14
|
+
|
|
15
|
+
### OCR/VLM (`ocr`)
|
|
16
|
+
|
|
17
|
+
| Repository | Stars | Key Patterns |
|
|
18
|
+
|-----------|-------|----------|
|
|
19
|
+
| [Multimodal-OCR](https://github.com/PRITHIVSAKTHIUR/Multimodal-OCR) | 14 | Multi-model selection, streaming output, Image/Video tabs |
|
|
20
|
+
| [Qwen3-VL-Outpost](https://github.com/PRITHIVSAKTHIUR/Qwen3-VL-Outpost) | 6 | PDF processing, GIF support, custom themes |
|
|
21
|
+
| [Multimodal-OCR2](https://github.com/PRITHIVSAKTHIUR/Multimodal-OCR2) | 4 | Video OCR, markdown output |
|
|
22
|
+
|
|
23
|
+
### Image Classification (`classify`)
|
|
24
|
+
|
|
25
|
+
| Repository | Stars | Key Patterns |
|
|
26
|
+
|-----------|-------|----------|
|
|
27
|
+
| [deepfake-detector-model-v1](https://github.com/PRITHIVSAKTHIUR/deepfake-detector-model-v1) | 15 | gr.Interface, SiglipForImageClassification |
|
|
28
|
+
| [AIorNot-SigLIP2](https://github.com/PRITHIVSAKTHIUR/AIorNot-SigLIP2) | 3 | Binary classification, gr.Label output |
|
|
29
|
+
|
|
30
|
+
### Image Generation (`generate`)
|
|
31
|
+
|
|
32
|
+
| Repository | Stars | Key Patterns |
|
|
33
|
+
|-----------|-------|----------|
|
|
34
|
+
| [FLUX-REALISM](https://github.com/PRITHIVSAKTHIUR/FLUX-REALISM) | 15 | Style dictionary, LoRA loading, dual models |
|
|
35
|
+
| [Flux-LoRA-DLC](https://github.com/PRITHIVSAKTHIUR/Flux-LoRA-DLC) | 13 | 255+ LoRA collection, dynamic loading |
|
|
36
|
+
| [Imagineo-4K](https://github.com/PRITHIVSAKTHIUR/Imagineo-4K) | 12 | Grid generation, filter/style combinations |
|
|
37
|
+
|
|
38
|
+
### Segmentation (`segment`)
|
|
39
|
+
|
|
40
|
+
| Repository | Stars | Key Patterns |
|
|
41
|
+
|-----------|-------|----------|
|
|
42
|
+
| [SAM3-Image-Segmentation](https://github.com/PRITHIVSAKTHIUR/SAM3-Image-Segmentation) | 2 | gr.AnnotatedImage, text prompts |
|
|
43
|
+
|
|
44
|
+
### Image Editing (`edit`)
|
|
45
|
+
|
|
46
|
+
| Repository | Stars | Key Patterns |
|
|
47
|
+
|-----------|-------|----------|
|
|
48
|
+
| [Qwen-Image-Edit-2509-LoRAs-Fast](https://github.com/PRITHIVSAKTHIUR/Qwen-Image-Edit-2509-LoRAs-Fast) | 5 | LoRA adapter selection, image editing |
|
|
49
|
+
| [Magic_Eraser](https://github.com/PRITHIVSAKTHIUR/Magic_Eraser) | 15 | Streamlit canvas, inpainting |
|
|
50
|
+
|
|
51
|
+
### Image Captioning (`caption`)
|
|
52
|
+
|
|
53
|
+
| Repository | Stars | Key Patterns |
|
|
54
|
+
|-----------|-------|----------|
|
|
55
|
+
| [Florence-2-Image-Caption](https://github.com/PRITHIVSAKTHIUR/Florence-2-Image-Caption) | 6 | Model selection radio buttons, detailed captions |
|
|
56
|
+
|
|
57
|
+
### Detection (`detect`)
|
|
58
|
+
|
|
59
|
+
| Repository | Stars | Key Patterns |
|
|
60
|
+
|-----------|-------|----------|
|
|
61
|
+
| [deepfake-detector-model-v1](https://github.com/PRITHIVSAKTHIUR/deepfake-detector-model-v1) | 15 | Real/Fake binary classification |
|
|
62
|
+
| [AIorNot-SigLIP2](https://github.com/PRITHIVSAKTHIUR/AIorNot-SigLIP2) | 3 | AI/Real detection |
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Additional Reference Repositories
|
|
67
|
+
|
|
68
|
+
### Fine-tuning & Notebooks
|
|
69
|
+
|
|
70
|
+
| Repository | Stars | Description |
|
|
71
|
+
|-----------|-------|------|
|
|
72
|
+
| [FineTuning-SigLIP-2](https://github.com/PRITHIVSAKTHIUR/FineTuning-SigLIP-2) | 44 | Image classification model fine-tuning notebooks |
|
|
73
|
+
| [Multimodal-Outpost-Notebooks](https://github.com/PRITHIVSAKTHIUR/Multimodal-Outpost-Notebooks) | 24 | VLM implementation notebooks |
|
|
74
|
+
| [OCR-ReportLab-Notebooks](https://github.com/PRITHIVSAKTHIUR/OCR-ReportLab-Notebooks) | 23 | OCR experiment notebooks |
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## Key Code Patterns Summary
|
|
79
|
+
|
|
80
|
+
### 1. Custom Theme Structure
|
|
81
|
+
|
|
82
|
+
Common theme pattern used across all apps:
|
|
83
|
+
- Inherits from `gradio.themes.Soft`
|
|
84
|
+
- Custom Color definitions
|
|
85
|
+
- Gradient backgrounds and buttons (original style)
|
|
86
|
+
|
|
87
|
+
**Note**: This skill replaces gradients with solid colors to avoid an AI-generated aesthetic.
|
|
88
|
+
|
|
89
|
+
### 2. GPU Compatibility Pattern
|
|
90
|
+
|
|
91
|
+
```python
|
|
92
|
+
try:
|
|
93
|
+
import spaces
|
|
94
|
+
@spaces.GPU
|
|
95
|
+
def inference(...): ...
|
|
96
|
+
except ImportError:
|
|
97
|
+
def inference(...): ...
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### 3. Streaming Output Pattern
|
|
101
|
+
|
|
102
|
+
```python
|
|
103
|
+
from transformers import TextIteratorStreamer
|
|
104
|
+
import threading
|
|
105
|
+
|
|
106
|
+
streamer = TextIteratorStreamer(tokenizer, skip_special_tokens=True)
|
|
107
|
+
thread = threading.Thread(target=model.generate, kwargs={..., "streamer": streamer})
|
|
108
|
+
thread.start()
|
|
109
|
+
|
|
110
|
+
for text in streamer:
|
|
111
|
+
yield partial_output + text
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### 4. Model Selection Pattern
|
|
115
|
+
|
|
116
|
+
```python
|
|
117
|
+
MODELS = {
|
|
118
|
+
"Model A": "path/to/model-a",
|
|
119
|
+
"Model B": "path/to/model-b",
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
model_selector = gr.Radio(list(MODELS.keys()), value="Model A", label="Select Model")
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### 5. Example Images Pattern
|
|
126
|
+
|
|
127
|
+
```python
|
|
128
|
+
examples = [
|
|
129
|
+
["examples/image1.jpg", "Prompt 1"],
|
|
130
|
+
["examples/image2.jpg", "Prompt 2"],
|
|
131
|
+
]
|
|
132
|
+
|
|
133
|
+
gr.Examples(examples=examples, inputs=[image_input, prompt_input])
|
|
134
|
+
```
|