Falah commited on
Commit
47ba4f7
·
1 Parent(s): 473bbf8

Add application file

Browse files
Files changed (3) hide show
  1. app.py +46 -0
  2. git-command.txt +3 -0
  3. options.yaml +51 -0
app.py ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import yaml
2
+ import pyperclip
3
+ import gradio as gr
4
+
5
+ def get_options(file_path):
6
+ with open(file_path, 'r') as file:
7
+ options = yaml.load(file, Loader=yaml.FullLoader)
8
+ return options
9
+
10
+ def generate_output(topic, options):
11
+ output = topic + ', ' + ', '.join([options[key] for key in options])
12
+ return output
13
+
14
+ def run_app(file_path='options.yaml'):
15
+ options = get_options(file_path)
16
+
17
+ inputs = [
18
+ gr.inputs.Textbox(label="Enter image topic:")
19
+ ]
20
+
21
+ for key in options.keys():
22
+ inputs.append(gr.inputs.Dropdown(options[key], label=key))
23
+
24
+ outputs = gr.outputs.Textbox(label="Output:")
25
+
26
+ def submit_handler(*input_values):
27
+ topic = input_values[0]
28
+ option_values = {}
29
+ for i, key in enumerate(options.keys()):
30
+ option_values[key] = input_values[i+1]
31
+ output = generate_output(topic, option_values)
32
+ pyperclip.copy(output)
33
+ return output
34
+
35
+ interface = gr.Interface(
36
+ submit_handler,
37
+ inputs,
38
+ outputs,
39
+ title="Image Prompt Generator",
40
+ description="Select options to generate image prompt and copy to clipboard."
41
+ )
42
+
43
+ interface.launch()
44
+
45
+ if __name__ == '__main__':
46
+ run_app()
git-command.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ git add *
2
+ git commit -m "Add application file"
3
+ git push
options.yaml ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Style:
2
+ - Abstract
3
+ - Classic
4
+ - Dada movement
5
+ - Modern
6
+ - Psychedelic
7
+ - Orphism
8
+ - Minimalism
9
+ - Naive art
10
+ - Retro
11
+ - Surreal
12
+ Artist:
13
+ - Abbott Fuller Graves
14
+ - Abbott Handerson Thayer
15
+ - Anne Truitt
16
+ - Auguste Rodin
17
+ - Afarin Sajedi
18
+ - Brian Jungen
19
+ - Dan Colen
20
+ - Jamie Hewlett
21
+ - Fairy Kei
22
+ Option:
23
+ - Color Grading
24
+ - Depth of Field
25
+ - Cinematic
26
+ - Backlight
27
+ - Natural Lighting
28
+ - HDR
29
+ - Incandescent
30
+ - Moody Lighting
31
+ - Glowing
32
+ - Ektachrome
33
+ - Studio Lighting
34
+ Detail level:
35
+ - minimalistic details
36
+ - normal details
37
+ - high details
38
+ - very high details
39
+ - extreme level of details
40
+ Output style:
41
+ - pen drawing
42
+ - oil painting
43
+ - water colour painting
44
+ - 3d render
45
+ - sculpture
46
+ - cartoon
47
+ - anime
48
+ - line art
49
+ - pixel art
50
+ - graffiti
51
+ - sketch