multimodalart HF staff commited on
Commit
e4ee626
1 Parent(s): 4b59481

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -156,12 +156,12 @@ def check_civit_link(profile: Optional[gr.OAuthProfile], url):
156
  attributes_methods = dir(profile)
157
  if(not hf_username):
158
  no_username_text = f'If you are {info["creator"]} on CivitAI, hi! Your CivitAI profile seems to not have information about your Hugging Face account. Please visit <a href="https://civitai.com/user/account" target="_blank">https://civitai.com/user/account</a> and include it there<br><img width="60%" src="https://i.imgur.com/hCbo9uL.png" /><br>(if you are not {info["creator"]}, you cannot submit their model at this time)'
159
- return no_username_text, gr.update(interactive=False), gr.update(visible=True), hf_username
160
  if(profile.preferred_username != hf_username):
161
  unmatched_username_text = '<h4>Oops, the Hugging Face account in your CivitAI profile seems to be different than the one your are using here. Please visit <a href="https://civitai.com/user/account">https://civitai.com/user/account</a> and update it there<br><img src="https://i.imgur.com/hCbo9uL.png" /></h4>'
162
- return unmatched_username_text, gr.update(interactive=False), gr.update(visible=True), hf_username
163
  else:
164
- return '', gr.update(interactive=True), gr.update(visible=False), hf_username
165
 
166
  def swap_fill(profile: Optional[gr.OAuthProfile]):
167
  if profile is None:
@@ -272,9 +272,8 @@ Get diffusers compatibility, a free GPU-based Inference Widget and possibility t
272
  submit_button_civit = gr.Button("Upload model to Hugging Face", interactive=False)
273
  output = gr.Markdown(label="Output progress", visible=False)
274
 
275
- civit_username = gr.State()
276
  demo.load(fn=swap_fill, outputs=[disabled_area, enabled_area])
277
- submit_source_civit.change(fn=check_civit_link, inputs=[submit_source_civit], outputs=[instructions, submit_button_civit, try_again_button, civit_username])
278
  try_again_button.click(fn=check_civit_link, inputs=[submit_source_civit], outputs=[instructions, submit_button_civit, try_again_button])
279
  submit_button_civit.click(fn=show_output, inputs=[], outputs=[output]).then(fn=upload_civit_to_hf, inputs=[submit_source_civit], outputs=[output])
280
  gr.LogoutButton(elem_id="logout")
 
156
  attributes_methods = dir(profile)
157
  if(not hf_username):
158
  no_username_text = f'If you are {info["creator"]} on CivitAI, hi! Your CivitAI profile seems to not have information about your Hugging Face account. Please visit <a href="https://civitai.com/user/account" target="_blank">https://civitai.com/user/account</a> and include it there<br><img width="60%" src="https://i.imgur.com/hCbo9uL.png" /><br>(if you are not {info["creator"]}, you cannot submit their model at this time)'
159
+ return no_username_text, gr.update(interactive=False), gr.update(visible=True), gr.update(visible=False)
160
  if(profile.preferred_username != hf_username):
161
  unmatched_username_text = '<h4>Oops, the Hugging Face account in your CivitAI profile seems to be different than the one your are using here. Please visit <a href="https://civitai.com/user/account">https://civitai.com/user/account</a> and update it there<br><img src="https://i.imgur.com/hCbo9uL.png" /></h4>'
162
+ return unmatched_username_text, gr.update(interactive=False), gr.update(visible=True), gr.update(visible=False)
163
  else:
164
+ return '', gr.update(interactive=True), gr.update(visible=False), gr.update(visible=True)
165
 
166
  def swap_fill(profile: Optional[gr.OAuthProfile]):
167
  if profile is None:
 
272
  submit_button_civit = gr.Button("Upload model to Hugging Face", interactive=False)
273
  output = gr.Markdown(label="Output progress", visible=False)
274
 
 
275
  demo.load(fn=swap_fill, outputs=[disabled_area, enabled_area])
276
+ submit_source_civit.change(fn=check_civit_link, inputs=[submit_source_civit], outputs=[instructions, submit_button_civit, try_again_button, submit_button_civit])
277
  try_again_button.click(fn=check_civit_link, inputs=[submit_source_civit], outputs=[instructions, submit_button_civit, try_again_button])
278
  submit_button_civit.click(fn=show_output, inputs=[], outputs=[output]).then(fn=upload_civit_to_hf, inputs=[submit_source_civit], outputs=[output])
279
  gr.LogoutButton(elem_id="logout")