Update app.py
Browse files
app.py
CHANGED
|
@@ -1,11 +1,22 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
|
| 3 |
-
from matplotlib import gridspec
|
| 4 |
-
import matplotlib.pyplot as plt
|
| 5 |
import numpy as np
|
| 6 |
from PIL import Image
|
| 7 |
import tensorflow as tf
|
| 8 |
from transformers import SegformerFeatureExtractor, TFSegformerForSemanticSegmentation
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
feature_extractor = SegformerFeatureExtractor.from_pretrained(
|
| 11 |
"mattmdjaga/segformer_b2_clothes"
|
|
|
|
| 1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
| 2 |
import numpy as np
|
| 3 |
from PIL import Image
|
| 4 |
import tensorflow as tf
|
| 5 |
from transformers import SegformerFeatureExtractor, TFSegformerForSemanticSegmentation
|
| 6 |
+
from matplotlib import gridspec
|
| 7 |
+
import matplotlib.pyplot as plt
|
| 8 |
+
|
| 9 |
+
# TensorFlow 버전 충돌 해결을 위해 2.0 버전 이상을 사용
|
| 10 |
+
if tf.__version__.startswith("1."):
|
| 11 |
+
tf.compat.v1.disable_v2_behavior()
|
| 12 |
+
tf.compat.v1.enable_eager_execution()
|
| 13 |
+
tf.compat.v1.InteractiveSession()
|
| 14 |
+
tf.compat.v1.get_default_graph()
|
| 15 |
+
tf.compat.v1.disable_eager_execution()
|
| 16 |
+
|
| 17 |
+
# 모델 및 특성 추출기 로드
|
| 18 |
+
feature_extractor = SegformerFeatureExtractor.from_pretrained("mattmdjaga/segformer_b2_clothes")
|
| 19 |
+
model = TFSegformerForSemanticSegmentation.from_pretrained("mattmdjaga/segformer_b2_clothes")
|
| 20 |
|
| 21 |
feature_extractor = SegformerFeatureExtractor.from_pretrained(
|
| 22 |
"mattmdjaga/segformer_b2_clothes"
|