P01yH3dr0n commited on
Commit
a658c23
1 Parent(s): 8584ad1

tagcomplete fix

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -34,6 +34,9 @@ def control_ui():
34
  elem_id='txt2img_neg_prompt', label="负面词", lines=1,
35
  value=client_config['default_neg'],
36
  )
 
 
 
37
  with gr.Row():
38
  sampler = gr.Dropdown(
39
  choices=[
@@ -202,7 +205,6 @@ def load_javascript():
202
  head = ''
203
  for f in sorted(os.listdir('./tagcomplete/javascript')):
204
  head += f'<script type="text/javascript" src="file=tagcomplete/javascript/{f}"></script>\n'
205
- head += '<script>window.onload = function () {setTimeout(run, 5000);};</script>\n'
206
 
207
  share = gr.routes.templates.TemplateResponse
208
  def template_response(*args, **kwargs):
@@ -232,7 +234,7 @@ def send_jump_select(component, fn, inputs, outputs, tab, accordin, trigger, sec
232
  def ui():
233
  load_javascript()
234
  set_token(os.environ.get('token'))
235
- with gr.Blocks(title="NAI Client", theme=gr.themes.Base(), js="() => {document.body.classList.toggle('dark', true);}") as website:
236
  with gr.Row():
237
  remain_anlas = gr.Textbox(label="剩余点数", value=get_remain_anlas, scale=3)
238
  refresh = gr.Button("🔄")
@@ -250,7 +252,7 @@ def ui():
250
  switchLightDark = gr.Button(value="切换浅色/深色模式")
251
  switchLightDark.click(fn=None, js="() => {document.body.classList.toggle('dark');}")
252
  loadTagComplete = gr.Button(value="重新加载tag补全")
253
- loadTagComplete.click(fn=None, js="() => {run();}")
254
  clearTagCache = gr.Button(value="清除tag补全缓存")
255
  clearTagCache.click(fn=None, js="() => {localStorage.clear();}")
256
  send_and_jump(png2main, send_paras, [png_items] + paras[:14], paras[:14], "client_ui_main", read_image)
 
34
  elem_id='txt2img_neg_prompt', label="负面词", lines=1,
35
  value=client_config['default_neg'],
36
  )
37
+ prompt.focus(fn=None, inputs=None, js="() => {run();}")
38
+ quality_tags.focus(fn=None, inputs=None, js="() => {run();}")
39
+ neg_prompt.focus(fn=None, inputs=None, js="() => {run();}")
40
  with gr.Row():
41
  sampler = gr.Dropdown(
42
  choices=[
 
205
  head = ''
206
  for f in sorted(os.listdir('./tagcomplete/javascript')):
207
  head += f'<script type="text/javascript" src="file=tagcomplete/javascript/{f}"></script>\n'
 
208
 
209
  share = gr.routes.templates.TemplateResponse
210
  def template_response(*args, **kwargs):
 
234
  def ui():
235
  load_javascript()
236
  set_token(os.environ.get('token'))
237
+ with gr.Blocks(title="NAI Client", analytics_enabled=False, theme=gr.themes.Soft(), js="() => {document.body.classList.toggle('dark', false);}") as website:
238
  with gr.Row():
239
  remain_anlas = gr.Textbox(label="剩余点数", value=get_remain_anlas, scale=3)
240
  refresh = gr.Button("🔄")
 
252
  switchLightDark = gr.Button(value="切换浅色/深色模式")
253
  switchLightDark.click(fn=None, js="() => {document.body.classList.toggle('dark');}")
254
  loadTagComplete = gr.Button(value="重新加载tag补全")
255
+ loadTagComplete.click(fn=None, js="() => {document.getElementById('client_ui_main-button').click();run();}")
256
  clearTagCache = gr.Button(value="清除tag补全缓存")
257
  clearTagCache.click(fn=None, js="() => {localStorage.clear();}")
258
  send_and_jump(png2main, send_paras, [png_items] + paras[:14], paras[:14], "client_ui_main", read_image)