Rooni commited on
Commit
fdcc416
1 Parent(s): b46dd4b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -38
app.py CHANGED
@@ -236,8 +236,8 @@ with gr.Blocks(css=css) as demo:
236
 
237
  with gr.Row():
238
  with gr.Column(scale=1):
239
- width = gr.Slider(label="Width", maximum=1024, value=512, step=8)
240
- height = gr.Slider(label="Height", maximum=1024, value=512, step=8)
241
 
242
  with gr.Column(scale=1):
243
  batch_size = gr.Slider(label="Batch Size", maximum=1, value=1)
@@ -258,7 +258,7 @@ with gr.Blocks(css=css) as demo:
258
  i2i_prompt = gr.Textbox("", placeholder="Prompt", show_label=False, lines=3)
259
  i2i_negative_prompt = gr.Textbox(placeholder="Negative Prompt", show_label=False, lines=3, value="[deformed | disfigured], poorly drawn, [bad : wrong] anatomy, [extra | missing | floating | disconnected] limb, (mutated hands and fingers), blurry")
260
  with gr.Column():
261
- i2i_text_button = gr.Button("Generate", variant='primary', elem_id="generate")
262
 
263
  with gr.Row():
264
  with gr.Column(scale=3):
@@ -274,8 +274,8 @@ with gr.Blocks(css=css) as demo:
274
 
275
  with gr.Row():
276
  with gr.Column(scale=1):
277
- i2i_width = gr.Slider(label="Width", maximum=1024, value=512, step=8)
278
- i2i_height = gr.Slider(label="Height", maximum=1024, value=512, step=8)
279
 
280
  with gr.Column(scale=1):
281
  i2i_batch_size = gr.Slider(label="Batch Size", maximum=1, value=1)
@@ -291,39 +291,7 @@ with gr.Blocks(css=css) as demo:
291
 
292
  i2i_text_button.click(img2img, inputs=[i2i_image_input, i2i_denoising, i2i_prompt, i2i_negative_prompt, model, i2i_steps, i2i_sampler, i2i_cfg_scale, i2i_width, i2i_height, i2i_seed], outputs=i2i_image_output)
293
 
294
- with gr.Tab("PNG Info"):
295
- def plaintext_to_html(text, classname=None):
296
- content = "<br>\n".join(html.escape(x) for x in text.split('\n'))
297
-
298
- return f"<p class='{classname}'>{content}</p>" if classname else f"<p>{content}</p>"
299
-
300
-
301
- def get_exif_data(image):
302
- items = image.info
303
-
304
- info = ''
305
- for key, text in items.items():
306
- info += f"""
307
- <div>
308
- <p><b>{plaintext_to_html(str(key))}</b></p>
309
- <p>{plaintext_to_html(str(text))}</p>
310
- </div>
311
- """.strip()+"\n"
312
-
313
- if len(info) == 0:
314
- message = "Nothing found in the image."
315
- info = f"<div><p>{message}<p></div>"
316
-
317
- return info
318
-
319
- with gr.Row():
320
- with gr.Column():
321
- image_input = gr.Image(type="pil")
322
-
323
- with gr.Column():
324
- exif_output = gr.HTML(label="EXIF Data")
325
- send_to_txt2img_btn = gr.Button("Send to txt2img")
326
-
327
  image_input.upload(get_exif_data, inputs=[image_input], outputs=exif_output)
328
  send_to_txt2img_btn.click(send_to_txt2img, inputs=[image_input], outputs=[tabs, prompt, negative_prompt, steps, seed,
329
  model, sampler, width, height, cfg_scale])
 
236
 
237
  with gr.Row():
238
  with gr.Column(scale=1):
239
+ width = gr.Slider(label="Ширина", maximum=1024, value=512, step=8)
240
+ height = gr.Slider(label="Длина", maximum=1024, value=512, step=8)
241
 
242
  with gr.Column(scale=1):
243
  batch_size = gr.Slider(label="Batch Size", maximum=1, value=1)
 
258
  i2i_prompt = gr.Textbox("", placeholder="Prompt", show_label=False, lines=3)
259
  i2i_negative_prompt = gr.Textbox(placeholder="Negative Prompt", show_label=False, lines=3, value="[deformed | disfigured], poorly drawn, [bad : wrong] anatomy, [extra | missing | floating | disconnected] limb, (mutated hands and fingers), blurry")
260
  with gr.Column():
261
+ i2i_text_button = gr.Button("Генерация", variant='primary', elem_id="generate")
262
 
263
  with gr.Row():
264
  with gr.Column(scale=3):
 
274
 
275
  with gr.Row():
276
  with gr.Column(scale=1):
277
+ i2i_width = gr.Slider(label="Ширина", maximum=1024, value=512, step=8)
278
+ i2i_height = gr.Slider(label="Высота", maximum=1024, value=512, step=8)
279
 
280
  with gr.Column(scale=1):
281
  i2i_batch_size = gr.Slider(label="Batch Size", maximum=1, value=1)
 
291
 
292
  i2i_text_button.click(img2img, inputs=[i2i_image_input, i2i_denoising, i2i_prompt, i2i_negative_prompt, model, i2i_steps, i2i_sampler, i2i_cfg_scale, i2i_width, i2i_height, i2i_seed], outputs=i2i_image_output)
293
 
294
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
295
  image_input.upload(get_exif_data, inputs=[image_input], outputs=exif_output)
296
  send_to_txt2img_btn.click(send_to_txt2img, inputs=[image_input], outputs=[tabs, prompt, negative_prompt, steps, seed,
297
  model, sampler, width, height, cfg_scale])