TInkDD commited on
Commit
e7e45bf
·
verified ·
1 Parent(s): 84abfd0

Delete prompt.py

Browse files
Files changed (1) hide show
  1. prompt.py +0 -77
prompt.py DELETED
@@ -1,77 +0,0 @@
1
- import json
2
- import random
3
- from pathlib import Path
4
-
5
- import gradio as gr
6
- from PIL import Image
7
- from migration import migration_1
8
- from background_design import background_design
9
- from settings import COMFY_UI_PATH
10
- from websockets_api import get_prompt_images
11
-
12
- image_hose = "image\image_hose.png"
13
- image_Long_bottle = "image\image_Long_bottle.png"
14
- image_mask = "image\image_mask.png"
15
- mage_vial = "image\image_vial.png"
16
-
17
- prompt1 = "Translucent,flowing,soft,illusory,mixed,dreamlike, watercolor,pigment,impressionist,paper texture,colorful,text"
18
- prompt2 = "Chinese painting,Transparent,high-end,high-end feel,transparency,Zen,inspired,Traditional,Minimalism,Works of Qi Baishi"
19
- prompt3 = "luxurious,High Fashion,haute couture,elegant,Hot stamping,embossing,Two tone gradient,High end craftsmanship,Glass"
20
- prompt4 = "medicine,chemistry,White,red,Medical patternv,Technology,Logo"
21
-
22
- def save_input_image(img):
23
- input_img = Path(COMFY_UI_PATH) / "input/basic_Image.jpg"
24
- pillow_image = Image.fromarray(img)
25
- pillow_image.save(input_img)
26
-
27
- def sentence_builder(img,prompt_1,style,classification,cfg_vlue,steps,sampler_name,Latent_Batch):
28
- with open("text01.json", "r", encoding="utf-8") as f:
29
- prompt = json.load(f)
30
-
31
- prompt["382"]["inputs"]["noise_seed"] = random.randint(0, 999999999999)
32
- prompt["292"]["inputs"]["string"] = f"{prompt_1}"
33
- prompt["496"]["inputs"]["style"] = style
34
- prompt["434"]["inputs"]["string"] = f"{classification}"
35
- prompt["381"]["inputs"]["cfg"] = cfg_vlue
36
- prompt["379"]["inputs"]["steps"] = steps
37
- prompt["380"]["inputs"]["sampler_name"] = f"{sampler_name}"
38
- prompt["130"]["inputs"]["amount"] = Latent_Batch
39
-
40
-
41
- save_input_image(img)
42
- images = get_prompt_images(prompt)
43
- return images
44
-
45
- basic_wf = gr.Interface(
46
- fn=sentence_builder,
47
- inputs=[gr.Image(label="Style Image: ",width=710, height=710),
48
-
49
- gr.Textbox(label="提示词"),
50
- gr.Dropdown(
51
- ["高级时尚", "医美", "水彩","中国风"], label="风格选择", info="选择你喜欢的风格"
52
- ),
53
- gr.CheckboxGroup(["窄口瓶", "面膜", "软管"], label="瓶型分类", info="瓶型的类型"),
54
- gr.Slider(1, 10, value=5, step=1,label="CFG值", info="提高该值会使结果更加符合提示词,但过高会导致图像质量下降"),
55
- gr.Slider(1, 50, value=30, step=1,label="steps", info="采样步数"),
56
- gr.Dropdown(
57
- ["euler", "dpmpp_2m", "dpmpp_2m_sde","dpmpp_2m_sde_gpu","dpmpp_3m_sde","dpmmpp_3m_sde_gpu","ddpm","lcm","ipndm","ddim","uni_pc","uni_pc_bh2" ], label="采样器", info="每个型号的采样器对生成的效果有"
58
- ),
59
- gr.Slider(1, 4, value=4, step=1, label="图片批次数", info="生成图片的批次数"),
60
-
61
- ],
62
- outputs=[gr.Gallery(label="Outputs: ",height=710)],
63
- examples=[
64
- [image_hose, prompt1,"水彩", ["软管"],5,30,"uni_pc_bh2",4],
65
- [image_Long_bottle,prompt2,"中国风", ["窄口瓶"],5,30,"uni_pc_bh2",4],
66
- [image_mask,prompt3,"高级时尚", ["面膜"],5,30,"uni_pc_bh2",4],
67
- [mage_vial,prompt4,"医美", ["窄口瓶"],5,30,"uni_pc_bh2",4],
68
- ],
69
- title = "设计创意工作"
70
- )
71
- demo = gr.TabbedInterface(
72
- interface_list=[basic_wf],
73
- tab_names=["设计创意"])
74
-
75
-
76
- demo.queue()
77
- demo.launch(share=True)