Spaces:
Runtime error
Runtime error
JinHyeong99
commited on
Commit
ยท
463c121
1
Parent(s):
cf15f5b
app.py
CHANGED
@@ -10,7 +10,8 @@ feature_extractor = SegformerFeatureExtractor.from_pretrained("nvidia/segformer-
|
|
10 |
# ์ด๋ฏธ์ง๋ฅผ ์ฒ๋ฆฌํ๋ ํจ์
|
11 |
def predict(image):
|
12 |
# ์ด๋ฏธ์ง๋ฅผ ๋ชจ๋ธ์ ๋ง๊ฒ ๋ณํ
|
13 |
-
|
|
|
14 |
outputs = model(**inputs)
|
15 |
logits = outputs.logits
|
16 |
|
@@ -25,7 +26,7 @@ def predict(image):
|
|
25 |
# Gradio ์ธํฐํ์ด์ค ์์ฑ
|
26 |
demo = gr.Interface(
|
27 |
fn=predict,
|
28 |
-
inputs=gr.inputs.Image(
|
29 |
outputs=gr.outputs.Image(type='pil'),
|
30 |
examples=["image1.jpg", "image2.jpg", "image3.jpg"] # ์ธ ๊ฐ์ ์์ ์ด๋ฏธ์ง ๊ฒฝ๋ก
|
31 |
)
|
|
|
10 |
# ์ด๋ฏธ์ง๋ฅผ ์ฒ๋ฆฌํ๋ ํจ์
|
11 |
def predict(image):
|
12 |
# ์ด๋ฏธ์ง๋ฅผ ๋ชจ๋ธ์ ๋ง๊ฒ ๋ณํ
|
13 |
+
processed_image = image.resize((400, 600))
|
14 |
+
inputs = feature_extractor(images=processed_image, return_tensors="pt")
|
15 |
outputs = model(**inputs)
|
16 |
logits = outputs.logits
|
17 |
|
|
|
26 |
# Gradio ์ธํฐํ์ด์ค ์์ฑ
|
27 |
demo = gr.Interface(
|
28 |
fn=predict,
|
29 |
+
inputs=gr.inputs.Image(type='pil'),
|
30 |
outputs=gr.outputs.Image(type='pil'),
|
31 |
examples=["image1.jpg", "image2.jpg", "image3.jpg"] # ์ธ ๊ฐ์ ์์ ์ด๋ฏธ์ง ๊ฒฝ๋ก
|
32 |
)
|