eurekaky commited on
Commit
32db86c
·
1 Parent(s): c2926d1

Upload folder using huggingface_hub

Browse files
README.md CHANGED
@@ -1,12 +1,6 @@
1
  ---
2
- title: Portrait Gen
3
- emoji: 🐨
4
- colorFrom: yellow
5
- colorTo: pink
6
  sdk: gradio
7
- sdk_version: 3.36.1
8
- app_file: app.py
9
- pinned: false
10
  ---
11
-
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: Portrait_gen
3
+ app_file: portraitUIFree.py
 
 
4
  sdk: gradio
5
+ sdk_version: 3.34.0
 
 
6
  ---
 
 
__pycache__/portraitUIFree.cpython-310.pyc ADDED
Binary file (1.63 kB). View file
 
config.yml ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ # config file for AI prompt generator
3
+
4
+ templatePrompt:
5
+ - a {form} portrait of {object}, centered in frame, facing camera,
6
+ - symmetrical face, ideal human, {lens}, photography, ultra details, natural light,
7
+ - light background, photo, {lighting}
8
+
9
+ translation:
10
+ - form : ["相片級","繪畫風","動畫風","科技風","概念風"]
11
+
12
+ UI_Text :
13
+ - UI : {"label": ["畫風","角色","鏡頭","環境光線"],"info":["請選擇畫風","請選擇角色名稱 ?","請選擇拍攝鏡頭 ?","請選擇環境光線 ?"]}
14
+
15
+ actorName:
16
+ - Harry Potter
17
+ - Hermione Granger
18
+ - Ron Weasley
19
+ - Draco Malfoy
20
+ - Professor Minerva McGonagall
21
+ - Fred and George Weasley
22
+ - Bellatrix Lestrange
23
+ - Lord Voldemort
24
+ - Ginny Weasley
25
+ - Albus Dumbledore
26
+ - Neville Longbottom
27
+ - Dean Thomas
28
+ - Rubeus Hagrid
29
+ - Professor Severus Snape
30
+
31
+ form:
32
+ - photo realistic
33
+ - painting
34
+ - Anime
35
+ - Sci-fi
36
+ - Concept artists (video game)
37
+
38
+ lens:
39
+ - 85mm lens,f8
40
+ - Wide-angle lens
41
+ - Telephoto lens
42
+ - 24mm lens
43
+ - EF 70mm lens
44
+ - Bokeh lens
45
+ - Fish-eye lens
46
+ - 800mm lens
47
+ - macro lens
48
+
49
+ lighting:
50
+ - Studio lighting
51
+ - nostalgic lighting
52
+ - purple neon lighting
53
+ - Sun Rays
54
+ - Soft lighting
55
+ - Ambient lighting
56
+ - Ring lighting
57
+ - Sun lighting
58
+ - Cinematic lighting
59
+
config_en.yml ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ # config file for AI prompt generator
3
+
4
+ templatePrompt:
5
+ - a {form} portrait of {object}, centered in frame, facing camera,
6
+ - symmetrical face, ideal human, {lens}, photography, ultra details, natural light,
7
+ - light background, photo, {lighting}
8
+
9
+ translation:
10
+ - form : ["photo realistic","painting","Anime","Sci-fi","Concept artists"]
11
+
12
+ UI_Text :
13
+ - UI : {"label": ["Style","Character","Lens","Lighting"],
14
+ "info":["Please select style ?","Please input character name ?","Please select lens ?","Please select lighting ?"]}
15
+
16
+ actorName:
17
+ - Harry Potter
18
+ - Hermione Granger
19
+ - Ron Weasley
20
+ - Draco Malfoy
21
+ - Professor Minerva McGonagall
22
+ - Fred and George Weasley
23
+ - Bellatrix Lestrange
24
+ - Lord Voldemort
25
+ - Ginny Weasley
26
+ - Albus Dumbledore
27
+ - Neville Longbottom
28
+ - Dean Thomas
29
+ - Rubeus Hagrid
30
+ - Professor Severus Snape
31
+
32
+ form:
33
+ - photo realistic
34
+ - painting
35
+ - Anime
36
+ - Sci-fi
37
+ - Concept artists (video game)
38
+
39
+ lens:
40
+ - 85mm lens,f8
41
+ - Wide-angle lens
42
+ - Telephoto lens
43
+ - 24mm lens
44
+ - EF 70mm lens
45
+ - Bokeh lens
46
+ - Fish-eye lens
47
+ - 800mm lens
48
+ - macro lens
49
+
50
+ lighting:
51
+ - Studio lighting
52
+ - nostalgic lighting
53
+ - purple neon lighting
54
+ - Sun Rays
55
+ - Soft lighting
56
+ - Ambient lighting
57
+ - Ring lighting
58
+ - Sun lighting
59
+ - Cinematic lighting
60
+
portraitUIFree.py ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import yaml
3
+ import os
4
+
5
+ def translate(t,a,b):
6
+ result="none";
7
+ for i,f in enumerate(a):
8
+ if f==t:
9
+ #print(i);
10
+ #print(a[i]);
11
+ result=b[i];
12
+ break;
13
+ return result;
14
+
15
+ dir = os.path.dirname(__file__); # get current script path
16
+ configfile=dir+'\config_en.yml';
17
+ print(configfile)
18
+ #configfile = './config.yml';
19
+ #configfile = "d:/MyProjects/python/examples/gradio/sdwebui/config.yml";
20
+
21
+ with open(configfile, 'r', encoding="utf8") as f:
22
+ config = yaml.safe_load(f)
23
+
24
+ #import pprint
25
+ #pp = pprint.PrettyPrinter(indent=1)
26
+ #pp.pprint(config)
27
+
28
+ p_form=config['form'];
29
+ p_object=config['actorName'];
30
+ p_lens=config['lens'];
31
+ p_lighting=config['lighting'];
32
+
33
+ gprompt=""
34
+ for p in config['templatePrompt']:
35
+ gprompt += p;
36
+
37
+ translation=config['translation'];
38
+ #print(translation[0])
39
+ t_form=translation[0]['form'];
40
+ #print(t_form);
41
+
42
+ UI_Text=config['UI_Text'];
43
+ UI=UI_Text[0]['UI'];
44
+ #print(UI['label']);
45
+ #print(UI['info']);
46
+ UI_Label=UI['label'];
47
+ UI_Info=UI['info'];
48
+
49
+ #import sys
50
+ #sys.exit();
51
+
52
+ def prompt_builder(p1, p2, p3, p4):
53
+ pp1=translate(p1,t_form,p_form);
54
+ dprompt = gprompt.format(form=pp1,object=p2,lens=p3,lighting=p4);
55
+ print(dprompt)
56
+ return dprompt;
57
+
58
+ demo = gr.Interface(
59
+ prompt_builder,
60
+ [
61
+ gr.Radio( t_form, label=UI_Label[0], info=UI_Info[0]),
62
+ gr.Textbox(label=UI_Label[1], info=UI_Info[1]),
63
+ gr.Radio( p_lens, label=UI_Label[2], info=UI_Info[2]),
64
+ gr.Dropdown( p_lighting, label=UI_Label[3], info=UI_Info[3]),
65
+ ],
66
+ "text",
67
+ examples=[
68
+ [t_form[0],"Harry Potter","85mm lens,f8","Studio lighting"],
69
+ [t_form[0],"Hermione Granger","85mm lens,f8","Studio lighting"],
70
+ [t_form[1],"Hermione Granger","85mm lens,f8","purple neon lighting"],
71
+ [t_form[2],"Ron Weasley","24mm lens","nostalgic lighting"]
72
+ ]
73
+ )
74
+
75
+ if __name__ == "__main__":
76
+ #demo.launch(share=True)
77
+ demo.launch()
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ config_en.yml