selfitcamera commited on
Commit
d417cb0
1 Parent(s): b4297d4
Files changed (2) hide show
  1. .DS_Store +0 -0
  2. app.py +13 -5
.DS_Store CHANGED
Binary files a/.DS_Store and b/.DS_Store differ
 
app.py CHANGED
@@ -119,7 +119,13 @@ def onLoad(token_text, request: gr.Request):
119
  left_n = max(0, LimitTask-total_n)
120
  his_datas.append(msg)
121
  his_datas.append(f"Submit ({left_n} attempts left)")
122
- return his_datas
 
 
 
 
 
 
123
 
124
  with gr.Blocks(css=css) as demo:
125
  gr.Markdown(title)
@@ -172,15 +178,17 @@ with gr.Blocks(css=css) as demo:
172
  his_input3 = gr.HTML()
173
  his_output3 = gr.HTML()
174
 
175
- outputs_onload = [his_input1, his_output1, his_input2, his_output2, his_input3, his_output3,
176
- MK02, run_button]
177
 
178
  run_button.click(fn=onClick, inputs=[temp_image, user_image, caption_text,
179
  token_text, param4_text, param5_text], outputs=[res_image, info_text])
180
 
181
- refresh_button.click(fn=onLoad, inputs=[token_text], outputs=outputs_onload)
 
182
 
183
- demo.load(onLoad, inputs=[token_text], outputs=outputs_onload)
 
184
 
185
 
186
  if __name__ == "__main__":
 
119
  left_n = max(0, LimitTask-total_n)
120
  his_datas.append(msg)
121
  his_datas.append(f"Submit ({left_n} attempts left)")
122
+
123
+ print("Query parameters:", dict(request.query_params))
124
+ url_params = dict(request.query_params)
125
+ if 'token' in url_params:
126
+ token_text = url_params['token']
127
+
128
+ return token_text, *his_datas
129
 
130
  with gr.Blocks(css=css) as demo:
131
  gr.Markdown(title)
 
178
  his_input3 = gr.HTML()
179
  his_output3 = gr.HTML()
180
 
181
+ # outputs_onload = [his_input1, his_output1, his_input2, his_output2, his_input3, his_output3,
182
+ # MK02, run_button]
183
 
184
  run_button.click(fn=onClick, inputs=[temp_image, user_image, caption_text,
185
  token_text, param4_text, param5_text], outputs=[res_image, info_text])
186
 
187
+ refresh_button.click(fn=onLoad, inputs=[token_text], outputs=[token_text, his_input1, his_output1, his_input2, his_output2, his_input3, his_output3,
188
+ MK02, run_button])
189
 
190
+ demo.load(onLoad, inputs=[token_text], outputs=[token_text, his_input1, his_output1, his_input2, his_output2, his_input3, his_output3,
191
+ MK02, run_button])
192
 
193
 
194
  if __name__ == "__main__":