Spaces:
Sleeping
Sleeping
File size: 888 Bytes
ea56e72 cfdd604 ea56e72 ec17889 ea56e72 3946ab3 ea56e72 3946ab3 ea56e72 3946ab3 ea56e72 3946ab3 ea56e72 3946ab3 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
import gradio as gr
import cv2
import numpy as np
def convert_to_grayscale(image):
# ์ด๋ฏธ์ง๋ฅผ ํ๋ฐฑ์ผ๋ก ๋ณํ
gray_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
return gray_image
def convert_and_save(image):
# ์ด๋ฏธ์ง๋ฅผ ํ๋ฐฑ์ผ๋ก ๋ณํํ๊ณ , ๋ค์ด๋ก๋ ๊ฐ๋ฅํ PNG ํ์ผ๋ก ์ ์ฅ
gray_image = convert_to_grayscale(image)
output_path = "output.png"
cv2.imwrite(output_path, gray_image)
return gray_image, output_path
# Gradio ์ธํฐํ์ด์ค ์ ์
iface = gr.Interface(
fn=convert_and_save,
inputs="image",
outputs=["image", "file"],
examples=["1.png", "2.jpg", "3.png"], # ์ํ ์ด๋ฏธ์ง ์ถ๊ฐ
title="์ด๋ฏธ์ง ํ๋ฐฑ ๋ณํ๊ธฐ",
description="์ด๋ฏธ์ง๋ฅผ ์
๋ก๋ํ๋ฉด ํ๋ฐฑ์ผ๋ก ๋ณํํ๊ณ , PNG ํ์ผ์ผ๋ก ๋ค์ด๋ก๋ํ ์ ์์ต๋๋ค."
)
if __name__ == "__main__":
iface.launch()
|