Alexander Bagus commited on
Commit
b22119d
·
1 Parent(s): 2ef6e7d
Files changed (1) hide show
  1. app.py +80 -82
app.py CHANGED
@@ -88,94 +88,92 @@ with gr.Blocks() as demo:
88
  with gr.Column(elem_id="col-container"):
89
  with gr.Column():
90
  gr.HTML(read_file("static/header.html"))
91
- # with gr.Row():
92
- # with gr.Column():
93
- # prompt = gr.Textbox(
94
- # label="Prompt",
95
- # show_label=False,
96
- # lines=2,
97
- # placeholder="Enter your prompt",
98
- # # container=False,
99
- # )
100
- # is_polish_prompt = gr.Checkbox(label="Polish prompt", value=False)
101
- # run_button = gr.Button("Generate", variant="primary")
102
- # with gr.Accordion("Advanced Settings", open=False):
103
 
104
- # negative_prompt = gr.Textbox(
105
- # label="Negative prompt",
106
- # lines=2,
107
- # container=False,
108
- # placeholder="Enter your negative prompt",
109
- # value="blurry ugly bad"
110
- # )
111
- # num_inference_steps = gr.Slider(
112
- # label="Steps",
113
- # minimum=1,
114
- # maximum=50,
115
- # step=1,
116
- # value=20,
117
- # )
118
- # with gr.Row():
119
- # width = gr.Slider(
120
- # label="Width",
121
- # minimum=512,
122
- # maximum=1280,
123
- # step=32,
124
- # value=768,
125
- # )
126
-
127
- # height = gr.Slider(
128
- # label="Height",
129
- # minimum=512,
130
- # maximum=1280,
131
- # step=32,
132
- # value=1024,
133
- # )
134
- # with gr.Row():
135
- # seed = gr.Slider(
136
- # label="Seed",
137
- # minimum=0,
138
- # maximum=MAX_SEED,
139
- # step=1,
140
- # value=42,
141
- # )
142
- # guidance_scale = gr.Slider(
143
- # label="Guidance scale",
144
- # minimum=0.0,
145
- # maximum=10.0,
146
- # step=0.1,
147
- # value=1.0,
148
- # )
149
 
150
 
151
- # randomize_seed = gr.Checkbox(label="Randomize seed", value=True)
152
 
153
- # with gr.Column():
154
- # output_image = gr.Image(label="Generated image", show_label=False)
155
- # polished_prompt = gr.Textbox(label="Final prompt",lines=2, interactive=False)
156
 
157
 
158
- # gr.Examples(examples=examples, inputs=[prompt])
159
- # gr.Markdown(read_file("static/footer.md"))
160
-
161
- # run_button.click(
162
- # fn=prepare,
163
- # inputs=[prompt, is_polish_prompt],
164
- # outputs=[polished_prompt, is_polish_prompt]
165
- # ).then(
166
- # fn=inference,
167
- # inputs=[
168
- # polished_prompt,
169
- # negative_prompt,
170
- # width,
171
- # height,
172
- # seed,
173
- # randomize_seed,
174
- # guidance_scale,
175
- # num_inference_steps,
176
- # ],
177
- # outputs=[output_image, seed],
178
- # )
179
 
180
 
181
  if __name__ == "__main__":
 
88
  with gr.Column(elem_id="col-container"):
89
  with gr.Column():
90
  gr.HTML(read_file("static/header.html"))
91
+ with gr.Row():
92
+ with gr.Column():
93
+ prompt = gr.Textbox(
94
+ label="Prompt",
95
+ show_label=False,
96
+ lines=2,
97
+ placeholder="Enter your prompt",
98
+ # container=False,
99
+ )
100
+ is_polish_prompt = gr.Checkbox(label="Polish prompt", value=False)
101
+ run_button = gr.Button("Generate", variant="primary")
102
+ with gr.Accordion("Advanced Settings", open=False):
103
 
104
+ negative_prompt = gr.Textbox(
105
+ label="Negative prompt",
106
+ lines=2,
107
+ container=False,
108
+ placeholder="Enter your negative prompt",
109
+ value="blurry ugly bad"
110
+ )
111
+ num_inference_steps = gr.Slider(
112
+ label="Steps",
113
+ minimum=1,
114
+ maximum=50,
115
+ step=1,
116
+ value=20,
117
+ )
118
+ with gr.Row():
119
+ width = gr.Slider(
120
+ label="Width",
121
+ minimum=512,
122
+ maximum=1280,
123
+ step=32,
124
+ value=768,
125
+ )
126
+
127
+ height = gr.Slider(
128
+ label="Height",
129
+ minimum=512,
130
+ maximum=1280,
131
+ step=32,
132
+ value=1024,
133
+ )
134
+ with gr.Row():
135
+ seed = gr.Slider(
136
+ label="Seed",
137
+ minimum=0,
138
+ maximum=MAX_SEED,
139
+ step=1,
140
+ value=42,
141
+ )
142
+ guidance_scale = gr.Slider(
143
+ label="Guidance scale",
144
+ minimum=0.0,
145
+ maximum=10.0,
146
+ step=0.1,
147
+ value=1.0,
148
+ )
149
 
150
 
151
+ randomize_seed = gr.Checkbox(label="Randomize seed", value=True)
152
 
153
+ with gr.Column():
154
+ output_image = gr.Image(label="Generated image", show_label=False)
155
+ polished_prompt = gr.Textbox(label="Final prompt",lines=2, interactive=False)
156
 
157
 
158
+ gr.Examples(examples=examples, inputs=[prompt])
159
+ gr.Markdown(read_file("static/footer.md"))
160
+
161
+ run_button.click(
162
+ fn=inference,
163
+ inputs=[
164
+ prompt,
165
+ negative_prompt,
166
+ width,
167
+ height,
168
+ seed,
169
+ randomize_seed,
170
+ guidance_scale,
171
+ num_inference_steps,
172
+ ],
173
+ outputs=[output_image, seed],
174
+ ).then(
175
+
176
+ )
 
 
177
 
178
 
179
  if __name__ == "__main__":