Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import os
|
| 2 |
import cv2
|
| 3 |
import numpy as np
|
|
@@ -10,7 +14,7 @@ from typing import Tuple, Optional
|
|
| 10 |
|
| 11 |
from PIL import Image
|
| 12 |
from gradio_imageslider import ImageSlider
|
| 13 |
-
from transformers import AutoModelForImageSegmentation
|
| 14 |
from torchvision import transforms
|
| 15 |
|
| 16 |
import requests
|
|
@@ -18,9 +22,6 @@ from io import BytesIO
|
|
| 18 |
import zipfile
|
| 19 |
import random
|
| 20 |
|
| 21 |
-
# 오버라이드: tie_weights()를 빈 함수로 재정의하여 tie_weights 호출을 무시함.
|
| 22 |
-
PreTrainedModel.tie_weights = lambda self: None
|
| 23 |
-
|
| 24 |
torch.set_float32_matmul_precision('high')
|
| 25 |
torch.jit.script = lambda f: f
|
| 26 |
|
|
|
|
| 1 |
+
# 가장 상단에 패치를 적용 (모델 로딩 전에 실행)
|
| 2 |
+
from transformers import PreTrainedModel
|
| 3 |
+
PreTrainedModel.tie_weights = lambda self: None
|
| 4 |
+
|
| 5 |
import os
|
| 6 |
import cv2
|
| 7 |
import numpy as np
|
|
|
|
| 14 |
|
| 15 |
from PIL import Image
|
| 16 |
from gradio_imageslider import ImageSlider
|
| 17 |
+
from transformers import AutoModelForImageSegmentation
|
| 18 |
from torchvision import transforms
|
| 19 |
|
| 20 |
import requests
|
|
|
|
| 22 |
import zipfile
|
| 23 |
import random
|
| 24 |
|
|
|
|
|
|
|
|
|
|
| 25 |
torch.set_float32_matmul_precision('high')
|
| 26 |
torch.jit.script = lambda f: f
|
| 27 |
|