Spaces:
Running
Running
chore: use dropdown instead of radio
Browse files
app.py
CHANGED
|
@@ -2,20 +2,18 @@ from PIL import Image
|
|
| 2 |
|
| 3 |
import torch
|
| 4 |
|
| 5 |
-
import gradio as gr
|
| 6 |
-
|
| 7 |
from transformers import (
|
| 8 |
AutoImageProcessor,
|
| 9 |
AutoModelForImageClassification,
|
| 10 |
)
|
| 11 |
|
|
|
|
|
|
|
| 12 |
# import spaces # ZERO GPU
|
| 13 |
|
| 14 |
-
MODEL_NAME = "p1atdev/wd-swinv2-tagger-v3-hf"
|
| 15 |
|
| 16 |
-
MODEL_NAMES =
|
| 17 |
-
|
| 18 |
-
}
|
| 19 |
|
| 20 |
model = AutoModelForImageClassification.from_pretrained(
|
| 21 |
MODEL_NAME,
|
|
@@ -145,10 +143,11 @@ def demo():
|
|
| 145 |
interactive=True,
|
| 146 |
)
|
| 147 |
|
| 148 |
-
_model_radio = gr.
|
| 149 |
-
choices=
|
| 150 |
label="Model",
|
| 151 |
-
value=
|
|
|
|
| 152 |
)
|
| 153 |
|
| 154 |
start_btn = gr.Button(value="Start", variant="primary")
|
|
|
|
| 2 |
|
| 3 |
import torch
|
| 4 |
|
|
|
|
|
|
|
| 5 |
from transformers import (
|
| 6 |
AutoImageProcessor,
|
| 7 |
AutoModelForImageClassification,
|
| 8 |
)
|
| 9 |
|
| 10 |
+
import gradio as gr
|
| 11 |
+
|
| 12 |
# import spaces # ZERO GPU
|
| 13 |
|
|
|
|
| 14 |
|
| 15 |
+
MODEL_NAMES = ["p1atdev/wd-swinv2-tagger-v3-hf"]
|
| 16 |
+
MODEL_NAME = MODEL_NAMES[0]
|
|
|
|
| 17 |
|
| 18 |
model = AutoModelForImageClassification.from_pretrained(
|
| 19 |
MODEL_NAME,
|
|
|
|
| 143 |
interactive=True,
|
| 144 |
)
|
| 145 |
|
| 146 |
+
_model_radio = gr.Dropdown(
|
| 147 |
+
choices=MODEL_NAMES,
|
| 148 |
label="Model",
|
| 149 |
+
value=MODEL_NAMES[0],
|
| 150 |
+
interactive=True,
|
| 151 |
)
|
| 152 |
|
| 153 |
start_btn = gr.Button(value="Start", variant="primary")
|