Upload 2 files
Browse files
README.md
CHANGED
@@ -1,29 +1,29 @@
|
|
1 |
-
---
|
2 |
-
title: CL EVA02 LoRA ONNX Tagger
|
3 |
-
emoji: 🖼️
|
4 |
-
colorFrom: blue
|
5 |
-
colorTo: green
|
6 |
-
sdk: gradio
|
7 |
-
sdk_version: 4.43.0 # requirements.txt と合わせるか確認
|
8 |
-
app_file: app.py
|
9 |
-
# license: apache-2.0 # または適切なライセンス
|
10 |
-
# Pinned Hardware: T4 small (GPU) or CPU upgrade (CPU)
|
11 |
-
# pinned: false # 必要に応じてTrueに
|
12 |
-
# hardware: cpu-upgrade # or cuda-t4-small
|
13 |
-
# hf_token: YOUR_HF_TOKEN # Use secrets instead!
|
14 |
-
---
|
15 |
-
|
16 |
-
#
|
17 |
-
|
18 |
-
This Space demonstrates image tagging using a fine-tuned WD EVA02 model (converted to ONNX format).
|
19 |
-
|
20 |
-
**How to Use:**
|
21 |
-
1. Upload an image using the upload button.
|
22 |
-
2. Alternatively, paste an image URL into the browser (experimental paste handling).
|
23 |
-
3. Adjust the tag thresholds if needed.
|
24 |
-
4. Choose the output mode (Tags only or include visualization).
|
25 |
-
5. Click the "Predict" button.
|
26 |
-
|
27 |
-
**Note:**
|
28 |
-
- This Space uses a model from a **private** repository (`celstk/wd-eva02-lora-onnx`). You might need to duplicate this space and add your Hugging Face token (`HF_TOKEN`) to the Space secrets to allow downloading the model files.
|
29 |
- Image pasting behavior might vary across browsers.
|
|
|
1 |
+
---
|
2 |
+
title: CL EVA02 LoRA ONNX Tagger
|
3 |
+
emoji: 🖼️
|
4 |
+
colorFrom: blue
|
5 |
+
colorTo: green
|
6 |
+
sdk: gradio
|
7 |
+
sdk_version: 4.43.0 # requirements.txt と合わせるか確認
|
8 |
+
app_file: app.py
|
9 |
+
# license: apache-2.0 # または適切なライセンス
|
10 |
+
# Pinned Hardware: T4 small (GPU) or CPU upgrade (CPU)
|
11 |
+
# pinned: false # 必要に応じてTrueに
|
12 |
+
# hardware: cpu-upgrade # or cuda-t4-small
|
13 |
+
# hf_token: YOUR_HF_TOKEN # Use secrets instead!
|
14 |
+
---
|
15 |
+
|
16 |
+
# WD EVA02 LoRA ONNX Tagger
|
17 |
+
|
18 |
+
This Space demonstrates image tagging using a fine-tuned WD EVA02 model (converted to ONNX format).
|
19 |
+
|
20 |
+
**How to Use:**
|
21 |
+
1. Upload an image using the upload button.
|
22 |
+
2. Alternatively, paste an image URL into the browser (experimental paste handling).
|
23 |
+
3. Adjust the tag thresholds if needed.
|
24 |
+
4. Choose the output mode (Tags only or include visualization).
|
25 |
+
5. Click the "Predict" button.
|
26 |
+
|
27 |
+
**Note:**
|
28 |
+
- This Space uses a model from a **private** repository (`celstk/wd-eva02-lora-onnx`). You might need to duplicate this space and add your Hugging Face token (`HF_TOKEN`) to the Space secrets to allow downloading the model files.
|
29 |
- Image pasting behavior might vary across browsers.
|
app.py
CHANGED
@@ -199,14 +199,14 @@ def visualize_predictions(image: Image.Image, predictions: Dict, threshold: floa
|
|
199 |
|
200 |
# --- Plotting Setup ---
|
201 |
plt.rcParams['font.family'] = 'DejaVu Sans' # Ensure font compatibility
|
202 |
-
fig = plt.figure(figsize=(
|
203 |
gs = fig.add_gridspec(1, 2, width_ratios=[1.2, 1])
|
204 |
|
205 |
# Left side: Image
|
206 |
-
ax_img = fig.add_subplot(gs[0, 0])
|
207 |
-
ax_img.imshow(image)
|
208 |
-
ax_img.set_title("Original Image")
|
209 |
-
ax_img.axis('off')
|
210 |
|
211 |
# Right side: Tags
|
212 |
ax_tags = fig.add_subplot(gs[0, 1])
|
@@ -288,7 +288,7 @@ def visualize_predictions(image: Image.Image, predictions: Dict, threshold: floa
|
|
288 |
REPO_ID = "cella110n/cl_tagger"
|
289 |
# Use the specified ONNX model filename
|
290 |
ONNX_FILENAME = "cl_eva02_tagger_v1_250426/model.onnx"
|
291 |
-
#
|
292 |
TAG_MAPPING_FILENAME = "cl_eva02_tagger_v1_250426/tag_mapping.json"
|
293 |
CACHE_DIR = "./model_cache"
|
294 |
|
@@ -467,7 +467,7 @@ footer { display: none !important; }
|
|
467 |
|
468 |
with gr.Blocks(css=css) as demo:
|
469 |
gr.Markdown("# CL EVA02 ONNX Tagger")
|
470 |
-
gr.Markdown("Upload an image or paste an image URL to predict tags using the
|
471 |
with gr.Row():
|
472 |
with gr.Column(scale=1):
|
473 |
image_input = gr.Image(type="pil", label="Input Image", elem_id="input-image")
|
|
|
199 |
|
200 |
# --- Plotting Setup ---
|
201 |
plt.rcParams['font.family'] = 'DejaVu Sans' # Ensure font compatibility
|
202 |
+
fig = plt.figure(figsize=(12, 20), dpi=100)
|
203 |
gs = fig.add_gridspec(1, 2, width_ratios=[1.2, 1])
|
204 |
|
205 |
# Left side: Image
|
206 |
+
# ax_img = fig.add_subplot(gs[0, 0])
|
207 |
+
# ax_img.imshow(image)
|
208 |
+
# ax_img.set_title("Original Image")
|
209 |
+
# ax_img.axis('off')
|
210 |
|
211 |
# Right side: Tags
|
212 |
ax_tags = fig.add_subplot(gs[0, 1])
|
|
|
288 |
REPO_ID = "cella110n/cl_tagger"
|
289 |
# Use the specified ONNX model filename
|
290 |
ONNX_FILENAME = "cl_eva02_tagger_v1_250426/model.onnx"
|
291 |
+
# Correct the tag mapping path to match the ONNX model's directory
|
292 |
TAG_MAPPING_FILENAME = "cl_eva02_tagger_v1_250426/tag_mapping.json"
|
293 |
CACHE_DIR = "./model_cache"
|
294 |
|
|
|
467 |
|
468 |
with gr.Blocks(css=css) as demo:
|
469 |
gr.Markdown("# CL EVA02 ONNX Tagger")
|
470 |
+
gr.Markdown("Upload an image or paste an image URL to predict tags using the CL EVA02 Tagger model (ONNX), fine-tuned from [SmilingWolf/wd-eva02-large-tagger-v3](https://huggingface.co/SmilingWolf/wd-eva02-large-tagger-v3).")
|
471 |
with gr.Row():
|
472 |
with gr.Column(scale=1):
|
473 |
image_input = gr.Image(type="pil", label="Input Image", elem_id="input-image")
|