Alexander Bagus commited on
Commit
b4f488e
·
1 Parent(s): 87d48ff
Files changed (1) hide show
  1. app.py +57 -57
app.py CHANGED
@@ -121,7 +121,7 @@ css = """
121
 
122
  with open('examples/0_examples.json', 'r') as file: examples = json.load(file)
123
  with gr.Blocks() as demo:
124
- has_lora = True
125
  with gr.Column(elem_id="col-container"):
126
  with gr.Column():
127
  gr.HTML(read_file("static/header.html"))
@@ -140,67 +140,67 @@ with gr.Blocks() as demo:
140
  with gr.Column():
141
  lora_path = gr.Textbox(label="Generated LoRA path",lines=2, interactive=False)
142
  lora_download = gr.DownloadButton(label=f"Download LoRA", visible=has_lora)
143
-
144
- with gr.Row(visible=has_lora):
145
- gr.Markdown("Your LoRA is ready! Now, try generating some images.")
146
- with gr.Column():
147
- prompt = gr.Textbox(
148
- label="Prompt",
149
- show_label=False,
150
- lines=2,
151
- placeholder="Enter your prompt",
152
- value="a man in a fishing boat. high quality, detailed"
153
- # container=False,
154
- )
155
-
156
- imagen_button = gr.Button("Generate Image", variant="primary")
157
-
158
-
159
- with gr.Accordion("Advanced Settings", open=False):
160
-
161
- negative_prompt = gr.Textbox(
162
- label="Negative prompt",
163
  lines=2,
164
- container=False,
165
- placeholder="Enter your negative prompt",
166
- value="blurry, ugly, bad"
167
  )
168
- with gr.Row():
169
- num_inference_steps = gr.Slider(
170
- label="Steps",
171
- minimum=1,
172
- maximum=30,
173
- step=1,
174
- value=9,
175
- )
176
- control_context_scale = gr.Slider(
177
- label="Context scale",
178
- minimum=0.0,
179
- maximum=1.0,
180
- step=0.01,
181
- value=0.75,
182
- )
183
 
184
- with gr.Row():
185
- guidance_scale = gr.Slider(
186
- label="Guidance scale",
187
- minimum=0.0,
188
- maximum=10.0,
189
- step=0.1,
190
- value=1.0,
 
 
191
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
192
 
193
- seed = gr.Slider(
194
- label="Seed",
195
- minimum=0,
196
- maximum=MAX_SEED,
197
- step=1,
198
- value=42,
199
- )
200
- randomize_seed = gr.Checkbox(label="Randomize seed", value=False)
201
-
202
- with gr.Column():
203
- output_image = gr.Image(label="Generated image", show_label=False)
204
 
205
  # gr.Examples(examples=examples, inputs=[input_image])
206
  gr.Markdown(read_file("static/footer.md"))
 
121
 
122
  with open('examples/0_examples.json', 'r') as file: examples = json.load(file)
123
  with gr.Blocks() as demo:
124
+ has_lora = gr.State(True)
125
  with gr.Column(elem_id="col-container"):
126
  with gr.Column():
127
  gr.HTML(read_file("static/header.html"))
 
140
  with gr.Column():
141
  lora_path = gr.Textbox(label="Generated LoRA path",lines=2, interactive=False)
142
  lora_download = gr.DownloadButton(label=f"Download LoRA", visible=has_lora)
143
+ with gr.Group(visible=has_lora) as my_container:
144
+ with gr.Row():
145
+ gr.Markdown("Your LoRA is ready! Now, try generating some images.")
146
+ with gr.Column():
147
+ prompt = gr.Textbox(
148
+ label="Prompt",
149
+ show_label=False,
 
 
 
 
 
 
 
 
 
 
 
 
 
150
  lines=2,
151
+ placeholder="Enter your prompt",
152
+ value="a man in a fishing boat. high quality, detailed"
153
+ # container=False,
154
  )
155
+
156
+ imagen_button = gr.Button("Generate Image", variant="primary")
 
 
 
 
 
 
 
 
 
 
 
 
 
157
 
158
+
159
+ with gr.Accordion("Advanced Settings", open=False):
160
+
161
+ negative_prompt = gr.Textbox(
162
+ label="Negative prompt",
163
+ lines=2,
164
+ container=False,
165
+ placeholder="Enter your negative prompt",
166
+ value="blurry, ugly, bad"
167
  )
168
+ with gr.Row():
169
+ num_inference_steps = gr.Slider(
170
+ label="Steps",
171
+ minimum=1,
172
+ maximum=30,
173
+ step=1,
174
+ value=9,
175
+ )
176
+ control_context_scale = gr.Slider(
177
+ label="Context scale",
178
+ minimum=0.0,
179
+ maximum=1.0,
180
+ step=0.01,
181
+ value=0.75,
182
+ )
183
+
184
+ with gr.Row():
185
+ guidance_scale = gr.Slider(
186
+ label="Guidance scale",
187
+ minimum=0.0,
188
+ maximum=10.0,
189
+ step=0.1,
190
+ value=1.0,
191
+ )
192
+
193
+ seed = gr.Slider(
194
+ label="Seed",
195
+ minimum=0,
196
+ maximum=MAX_SEED,
197
+ step=1,
198
+ value=42,
199
+ )
200
+ randomize_seed = gr.Checkbox(label="Randomize seed", value=False)
201
 
202
+ with gr.Column():
203
+ output_image = gr.Image(label="Generated image", show_label=False)
 
 
 
 
 
 
 
 
 
204
 
205
  # gr.Examples(examples=examples, inputs=[input_image])
206
  gr.Markdown(read_file("static/footer.md"))