Transformers
Inference Endpoints
pantat88 commited on
Commit
bb0e584
·
1 Parent(s): eb71017

Update fast-pnginfo.py

Browse files
Files changed (1) hide show
  1. fast-pnginfo.py +32 -33
fast-pnginfo.py CHANGED
@@ -14,41 +14,40 @@ def get_self_extension():
14
  if ext.path in filepath:
15
  return ext
16
 
17
-
18
  def on_ui_tabs():
19
 
20
- ext = get_self_extension()
21
- if ext is None:
22
- return []
23
- js_ = [f'{x.path}?{os.path.getmtime(x.path)}' for x in ext.list_files('js', '.js')]
24
- js_.insert(0, ext.path)
25
-
26
-
27
- with gr.Blocks(analytics_enabled=False) as fast_pnginfo:
28
- with gr.Row():
29
- with gr.Column(scale=2):
30
- gr.HTML(value='\n'.join(js_), elem_id="fastpng_js_path", visible=False)
31
- gr.Markdown(
32
- f"""
33
- <center>
34
-
35
- </center>
36
- """)
37
- with gr.Row().style(equal_height=False):
38
- with gr.Column(variant='panel'):
39
- image = gr.Image(elem_id="fastpnginfo_image", label="Source", source="upload", interactive=True, type="pil")
40
- # image.change(lambda x: x, _js='(e)=>{console.log(e);fastpngprocess()}')
41
-
42
- with gr.Column(variant='panel'):
43
- submit = gr.Button(label="Submit", elem_id="fastpnginfo_submit", interactive=True, variant="primary", visible=True)
44
- fast_generation_info = gr.Textbox(label="Parameters", visible=True, elem_id="fastpnginfo_generation_info", interactive=False)
45
- with gr.Row():
46
- buttons = parameters_copypaste.create_buttons(["txt2img", "img2img", "inpaint", "extras"])
47
 
48
- for tabname, button in buttons.items():
49
- parameters_copypaste.register_paste_params_button(parameters_copypaste.ParamBinding(
50
- paste_button=button, tabname=tabname, source_text_component=fast_generation_info, source_image_component=image,
51
- ))
52
- return [(fast_pnginfo, "Fast PNG Info", "fast_pnginfo")];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
 
54
  script_callbacks.on_ui_tabs(on_ui_tabs)
 
14
  if ext.path in filepath:
15
  return ext
16
 
 
17
  def on_ui_tabs():
18
 
19
+ ext = get_self_extension()
20
+ if ext is None:
21
+ return []
22
+ js_ = [f'{x.path}?{os.path.getmtime(x.path)}' for x in ext.list_files('js', '.js')]
23
+ js_.insert(0, ext.path)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
 
25
+ with gr.Blocks(analytics_enabled=False) as fast_pnginfo:
26
+ with gr.Row():
27
+ with gr.Column(scale=2):
28
+ gr.HTML(value='\n'.join(js_), elem_id="fastpng_js_path", visible=False)
29
+ gr.Markdown(
30
+ f"""
31
+ <center>
32
+
33
+ </center>
34
+ """)
35
+
36
+ with gr.Row(equal_height=False): # Replace .style with Row
37
+ with gr.Column(variant='panel'):
38
+ image = gr.Image(elem_id="fastpnginfo_image", label="Source", source="upload", interactive=True, type="pil")
39
+ # image.change(lambda x: x, _js='(e)=>{console.log(e);fastpngprocess()}')
40
+
41
+ with gr.Column(variant='panel'):
42
+ submit = gr.Button(label="Submit", elem_id="fastpnginfo_submit", interactive=True, variant="primary", visible=True)
43
+ fast_generation_info = gr.Textbox(label="Parameters", visible=True, elem_id="fastpnginfo_generation_info", interactive=False)
44
+ with gr.Row():
45
+ buttons = parameters_copypaste.create_buttons(["txt2img", "img2img", "inpaint", "extras"])
46
+
47
+ for tabname, button in buttons.items():
48
+ parameters_copypaste.register_paste_params_button(parameters_copypaste.ParamBinding(
49
+ paste_button=button, tabname=tabname, source_text_component=fast_generation_info, source_image_component=image,
50
+ ))
51
+ return [(fast_pnginfo, "Fast PNG Info", "fast_pnginfo")]
52
 
53
  script_callbacks.on_ui_tabs(on_ui_tabs)