hugforziio commited on
Commit
864da09
1 Parent(s): 77a862a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -15
app.py CHANGED
@@ -70,6 +70,7 @@ def all_task_end(cnt,t_stamp):
70
  return d, tog
71
 
72
  def all_task_start():
 
73
  t = time.gmtime()
74
  t_stamp = time.time()
75
  current_time = time.strftime("%H:%M:%S", t)
@@ -77,20 +78,20 @@ def all_task_start():
77
 
78
  def clear_fn():
79
  nn = len(models)
80
- return tuple([None for _ in range(nn)])
81
 
82
 
83
 
84
  with gr.Blocks() as my_interface:
85
  with gr.Column(scale=12):
86
- with gr.Row():
87
- gr.Markdown("""- Primary prompt: 你想画的内容(英文单词,如 a cat, 加英文逗号效果更好;点 Improve 按钮进行完善)\n- Real prompt: 完善后的提示词,出现后再点右边的 Run 按钮开始运行""")
88
  with gr.Row():
89
  with gr.Column(scale=6):
90
- primary_prompt=gr.Textbox(label="Primary prompt")
91
- real_prompt=gr.Textbox(label="Real prompt")
92
  with gr.Column(scale=6):
93
- improve_prompts_btn=gr.Button("Improve")
94
  with gr.Row():
95
  run=gr.Button("Run")
96
  clear_btn=gr.Button("Clear")
@@ -122,26 +123,26 @@ with gr.Blocks() as my_interface:
122
  runs_dict = {}
123
  model_idx = 1
124
  for model_path in models:
125
- runs_dict[model_idx] = run.click(interfaces[model_idx], inputs=[real_prompt], outputs=[sd_outputs[model_idx]])
126
  model_idx += 1
127
  pass
128
  pass
129
 
130
- improve_prompts_btn_clicked=improve_prompts_btn.click(
131
- get_prompts,
132
- inputs=[primary_prompt],
133
- outputs=[real_prompt],
134
- cancels=list(runs_dict.values()))
135
  clear_btn.click(
136
  clear_fn,
137
  None,
138
- [primary_prompt, real_prompt, *list(sd_outputs.values())],
139
- cancels=[improve_prompts_btn_clicked, *list(runs_dict.values())])
140
  tog_box.change(
141
  clear_it,
142
  tog_box,
143
  tog_box,
144
- cancels=[*list(runs_dict.values()), improve_prompts_btn_clicked])
145
 
146
  my_interface.queue(concurrency_count=600, status_update_rate=1)
147
  my_interface.launch(inline=True, show_api=False)
 
70
  return d, tog
71
 
72
  def all_task_start():
73
+ print("\n\n\n\n\n\n\n")
74
  t = time.gmtime()
75
  t_stamp = time.time()
76
  current_time = time.strftime("%H:%M:%S", t)
 
78
 
79
  def clear_fn():
80
  nn = len(models)
81
+ return tuple([None, *[None for _ in range(nn)]])
82
 
83
 
84
 
85
  with gr.Blocks() as my_interface:
86
  with gr.Column(scale=12):
87
+ # with gr.Row():
88
+ # gr.Markdown("""- Primary prompt: 你想画的内容(英文单词,如 a cat, 加英文逗号效果更好;点 Improve 按钮进行完善)\n- Real prompt: 完善后的提示词,出现后再点右边的 Run 按钮开始运行""")
89
  with gr.Row():
90
  with gr.Column(scale=6):
91
+ primary_prompt=gr.Textbox(label="Prompt")
92
+ # real_prompt=gr.Textbox(label="Real prompt")
93
  with gr.Column(scale=6):
94
+ # improve_prompts_btn=gr.Button("Improve")
95
  with gr.Row():
96
  run=gr.Button("Run")
97
  clear_btn=gr.Button("Clear")
 
123
  runs_dict = {}
124
  model_idx = 1
125
  for model_path in models:
126
+ runs_dict[model_idx] = run.click(interfaces[model_idx], inputs=[primary_prompt], outputs=[sd_outputs[model_idx]])
127
  model_idx += 1
128
  pass
129
  pass
130
 
131
+ # improve_prompts_btn_clicked=improve_prompts_btn.click(
132
+ # get_prompts,
133
+ # inputs=[primary_prompt],
134
+ # outputs=[primary_prompt],
135
+ # cancels=list(runs_dict.values()))
136
  clear_btn.click(
137
  clear_fn,
138
  None,
139
+ [primary_prompt, *list(sd_outputs.values())],
140
+ cancels=[*list(runs_dict.values())])
141
  tog_box.change(
142
  clear_it,
143
  tog_box,
144
  tog_box,
145
+ cancels=[*list(runs_dict.values())])
146
 
147
  my_interface.queue(concurrency_count=600, status_update_rate=1)
148
  my_interface.launch(inline=True, show_api=False)