Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -172,11 +172,11 @@ tag_model = ram(pretrained='preset/models/ram_swin_large_14m.pth',
|
|
| 172 |
tag_model.eval()
|
| 173 |
tag_model.to(device, dtype=weight_dtype)
|
| 174 |
|
| 175 |
-
def preprocess_image(input_image: Image.Image):
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
return
|
| 179 |
-
|
| 180 |
@spaces.GPU()
|
| 181 |
def process(
|
| 182 |
input_image: Image.Image,
|
|
@@ -312,6 +312,10 @@ with gr.Blocks(css=css) as demo:
|
|
| 312 |
[
|
| 313 |
"preset/datasets/test_datasets/apologise.png",
|
| 314 |
],
|
|
|
|
|
|
|
|
|
|
|
|
|
| 315 |
],
|
| 316 |
inputs=[
|
| 317 |
input_image,
|
|
|
|
| 172 |
tag_model.eval()
|
| 173 |
tag_model.to(device, dtype=weight_dtype)
|
| 174 |
|
| 175 |
+
def preprocess_image(input_image: Image.Image) -> Image.Image:
|
| 176 |
+
img = input_image.copy()
|
| 177 |
+
img.thumbnail((256, 256), Image.Resampling.BILINEAR)
|
| 178 |
+
return img
|
| 179 |
+
|
| 180 |
@spaces.GPU()
|
| 181 |
def process(
|
| 182 |
input_image: Image.Image,
|
|
|
|
| 312 |
[
|
| 313 |
"preset/datasets/test_datasets/apologise.png",
|
| 314 |
],
|
| 315 |
+
[
|
| 316 |
+
"preset/datasets/test_datasets/gummibears.png",
|
| 317 |
+
],
|
| 318 |
+
|
| 319 |
],
|
| 320 |
inputs=[
|
| 321 |
input_image,
|