multimodalart HF staff commited on
Commit
6ce4e52
1 Parent(s): 605f32c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -168,14 +168,14 @@ def check_civit_link(profile: Optional[gr.OAuthProfile], url):
168
  info, _ = process_url(url, do_download=False)
169
  hf_username = extract_huggingface_username(info['creator'])
170
  attributes_methods = dir(profile)
171
- #if(not hf_username):
172
- # 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)'
173
- # return no_username_text, gr.update(interactive=False), gr.update(visible=True), gr.update(visible=False)
174
- #if(profile.preferred_username != hf_username):
175
- # 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>'
176
- # return unmatched_username_text, gr.update(interactive=False), gr.update(visible=True), gr.update(visible=False)
177
- #else:
178
- return '', gr.update(interactive=True), gr.update(visible=False), gr.update(visible=True)
179
 
180
  def swap_fill(profile: Optional[gr.OAuthProfile]):
181
  if profile is None:
 
168
  info, _ = process_url(url, do_download=False)
169
  hf_username = extract_huggingface_username(info['creator'])
170
  attributes_methods = dir(profile)
171
+ if(not hf_username):
172
+ 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)'
173
+ return no_username_text, gr.update(interactive=False), gr.update(visible=True), gr.update(visible=False)
174
+ if(profile.preferred_username != hf_username):
175
+ 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>'
176
+ return unmatched_username_text, gr.update(interactive=False), gr.update(visible=True), gr.update(visible=False)
177
+ else:
178
+ return '', gr.update(interactive=True), gr.update(visible=False), gr.update(visible=True)
179
 
180
  def swap_fill(profile: Optional[gr.OAuthProfile]):
181
  if profile is None: