Update pictureDeal2.py
Browse files- pictureDeal2.py +22 -3
pictureDeal2.py
CHANGED
|
@@ -3,14 +3,13 @@ import cv2
|
|
| 3 |
from PIL import Image, ImageEnhance,ImageColor
|
| 4 |
import gradio as gr
|
| 5 |
import numpy as np
|
|
|
|
| 6 |
|
| 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 |
-
|
| 13 |
-
with gr.Row():
|
| 14 |
with gr.Accordion("2.可更换勾边颜色,点加工图片"):
|
| 15 |
color = gr.ColorPicker(label="勾边颜色")
|
| 16 |
section_btn = gr.Button("加工图片")
|
|
@@ -24,7 +23,7 @@ with gr.Blocks() as interface:
|
|
| 24 |
with gr.Row():
|
| 25 |
closed_output2 = gr.Image(label='细致勾边')
|
| 26 |
closed_output3 = gr.Image(label='彩色勾边')
|
| 27 |
-
|
| 28 |
|
| 29 |
# 调整模型结果参数
|
| 30 |
def turn_arguments(img,color):
|
|
@@ -157,5 +156,25 @@ with gr.Blocks() as interface:
|
|
| 157 |
section_btn.click(turn_arguments,inputs=[img_input,color],
|
| 158 |
outputs = [closed_output0,closed_output1,closed_output2,closed_output3])
|
| 159 |
# outputs = [closed_output0,img_param_output0,closed_output1,img_param_output1,closed_output2,img_param_output2,closed_output3,img_param_output3])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 160 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 161 |
interface.launch(show_api=False)
|
|
|
|
| 3 |
from PIL import Image, ImageEnhance,ImageColor
|
| 4 |
import gradio as gr
|
| 5 |
import numpy as np
|
| 6 |
+
import datetime
|
| 7 |
|
| 8 |
with gr.Blocks() as interface:
|
| 9 |
|
| 10 |
with gr.Row():
|
| 11 |
with gr.Accordion("1.请选择一张待加工图片"):
|
| 12 |
img_input = gr.Image(label='图片',interactive=True)
|
|
|
|
|
|
|
| 13 |
with gr.Accordion("2.可更换勾边颜色,点加工图片"):
|
| 14 |
color = gr.ColorPicker(label="勾边颜色")
|
| 15 |
section_btn = gr.Button("加工图片")
|
|
|
|
| 23 |
with gr.Row():
|
| 24 |
closed_output2 = gr.Image(label='细致勾边')
|
| 25 |
closed_output3 = gr.Image(label='彩色勾边')
|
| 26 |
+
|
| 27 |
|
| 28 |
# 调整模型结果参数
|
| 29 |
def turn_arguments(img,color):
|
|
|
|
| 156 |
section_btn.click(turn_arguments,inputs=[img_input,color],
|
| 157 |
outputs = [closed_output0,closed_output1,closed_output2,closed_output3])
|
| 158 |
# outputs = [closed_output0,img_param_output0,closed_output1,img_param_output1,closed_output2,img_param_output2,closed_output3,img_param_output3])
|
| 159 |
+
|
| 160 |
+
def feed_back(fb_info):
|
| 161 |
+
f = open('feedback.txt', mode='a',encoding='utf-8-sig')
|
| 162 |
+
dt = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
|
| 163 |
+
result = f.writelines(dt+' , '+fb_info+'\n')
|
| 164 |
+
print('result->',result)
|
| 165 |
+
f.close()
|
| 166 |
+
return '我们已收到,谢谢反馈!'
|
| 167 |
|
| 168 |
+
#####################################
|
| 169 |
+
# 意见反馈 #
|
| 170 |
+
#####################################
|
| 171 |
+
with gr.Accordion("点击我,反馈意见 or 提出需求",open=False):
|
| 172 |
+
gr.Markdown("功能免费,服务无价,欢迎给我们提出任何意见和建议,我们会尽快改进")
|
| 173 |
+
with gr.Row():
|
| 174 |
+
fb_info = gr.TextArea(label='反馈内容',lines=7,value='hi,')
|
| 175 |
+
with gr.Row():
|
| 176 |
+
rInfo = gr.Markdown()
|
| 177 |
+
with gr.Row():
|
| 178 |
+
fb_btn = gr.Button("反馈",elem_classes=".gradio-button {}")
|
| 179 |
+
l = fb_btn.click(feed_back,inputs=[fb_info],outputs = [rInfo])
|
| 180 |
interface.launch(show_api=False)
|