Update pictureDeal2.py
Browse files- pictureDeal2.py +4 -18
pictureDeal2.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
import cv2
|
| 2 |
from PIL import Image, ImageEnhance,ImageColor
|
| 3 |
import gradio as gr
|
|
@@ -6,40 +7,25 @@ import numpy as np
|
|
| 6 |
with gr.Blocks() as interface:
|
| 7 |
|
| 8 |
with gr.Row():
|
| 9 |
-
with gr.Accordion("1.请选择一张待加工图片"):
|
| 10 |
img_input = gr.Image(label='图片',interactive=True)
|
| 11 |
with gr.Accordion("2.可更换勾边颜色,点加工图片"):
|
| 12 |
-
gr.Markdown("网页版效果更好:https://idalee-draweasy.hf.space")
|
| 13 |
color = gr.ColorPicker(label="勾边颜色")
|
| 14 |
-
section_btn = gr.Button("加工图片")
|
| 15 |
-
# img_param_output1 = gr.Image(label='勾边合成结果',interactive=False,tool='canvas')
|
| 16 |
-
|
| 17 |
-
# with gr.Accordion("每次调整参数后,点击【加工图片】按钮,得到图片的勾边"):
|
| 18 |
-
# with gr.Row():
|
| 19 |
-
# enhance = gr.Slider(0, 1, 0.8, step=0.1, label="图片彩色度")
|
| 20 |
-
# blend = gr.Slider(0, 1, 0.4, step=0.1, label="颜色填充度")
|
| 21 |
|
| 22 |
with gr.Accordion("【结果】4种勾边效果"):
|
|
|
|
| 23 |
with gr.Row():
|
| 24 |
closed_output0 = gr.Image(label='简单勾边')
|
| 25 |
closed_output1 = gr.Image(label='常规勾边')
|
| 26 |
-
# img_param_output0 = gr.Image(label='极简勾边')
|
| 27 |
-
|
| 28 |
-
# with gr.Row():
|
| 29 |
-
# img_param_output1 = gr.Image(label='简单勾边')
|
| 30 |
|
| 31 |
with gr.Row():
|
| 32 |
closed_output2 = gr.Image(label='细致勾边')
|
| 33 |
closed_output3 = gr.Image(label='彩色勾边')
|
| 34 |
-
# img_param_output2 = gr.Image(label='细致勾边')
|
| 35 |
-
|
| 36 |
-
# with gr.Row():
|
| 37 |
-
# img_param_output3 = gr.Image(label='图片+勾边合成图')
|
| 38 |
|
| 39 |
|
| 40 |
# 调整模型结果参数
|
| 41 |
def turn_arguments(img,color):
|
| 42 |
-
# def turn_arguments(img,enhance,blend,color):
|
| 43 |
imageX = Image.fromarray(img)
|
| 44 |
contrast = ImageEnhance.Contrast(imageX)
|
| 45 |
imageX = contrast.enhance(1.5)
|
|
|
|
| 1 |
+
|
| 2 |
import cv2
|
| 3 |
from PIL import Image, ImageEnhance,ImageColor
|
| 4 |
import gradio as gr
|
|
|
|
| 7 |
with gr.Blocks() as interface:
|
| 8 |
|
| 9 |
with gr.Row():
|
| 10 |
+
with gr.Accordion("1.请选择一张待加工图片"):
|
| 11 |
img_input = gr.Image(label='图片',interactive=True)
|
| 12 |
with gr.Accordion("2.可更换勾边颜色,点加工图片"):
|
|
|
|
| 13 |
color = gr.ColorPicker(label="勾边颜色")
|
| 14 |
+
section_btn = gr.Button("加工图片")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
with gr.Accordion("【结果】4种勾边效果"):
|
| 17 |
+
gr.Markdown("#### 手机下载图片,需长按图片2秒后松开,会出现保存方式")
|
| 18 |
with gr.Row():
|
| 19 |
closed_output0 = gr.Image(label='简单勾边')
|
| 20 |
closed_output1 = gr.Image(label='常规勾边')
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
with gr.Row():
|
| 23 |
closed_output2 = gr.Image(label='细致勾边')
|
| 24 |
closed_output3 = gr.Image(label='彩色勾边')
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
|
| 27 |
# 调整模型结果参数
|
| 28 |
def turn_arguments(img,color):
|
|
|
|
| 29 |
imageX = Image.fromarray(img)
|
| 30 |
contrast = ImageEnhance.Contrast(imageX)
|
| 31 |
imageX = contrast.enhance(1.5)
|