Spaces:
Running
Running
Commit
·
7ddb9ce
1
Parent(s):
4cca9c8
Update app.py
Browse files
app.py
CHANGED
|
@@ -171,15 +171,17 @@ def extract_huggingface_username(username):
|
|
| 171 |
for link in links:
|
| 172 |
url = link.get('url', '')
|
| 173 |
if url.startswith('https://huggingface.co/') or url.startswith('https://www.huggingface.co/'):
|
| 174 |
-
|
|
|
|
|
|
|
| 175 |
|
| 176 |
return None
|
| 177 |
|
| 178 |
|
| 179 |
-
|
| 180 |
def check_civit_link(profile: Optional[gr.OAuthProfile], url):
|
| 181 |
info, _ = process_url(url, download_files=False)
|
| 182 |
hf_username = extract_huggingface_username(info['creator'])
|
|
|
|
| 183 |
if(not hf_username):
|
| 184 |
no_username_text = 'Oops, your CivitAI profile seems to not have information about your Hugging Face account. Please visit <a href="https://civitai.com/user/account">https://civitai.com/user/account</a> and include it there<br><img width="60%" src="https://i.imgur.com/hCbo9uL.png" />'
|
| 185 |
return no_username_text, gr.update(), gr.update(visible=True)
|
|
|
|
| 171 |
for link in links:
|
| 172 |
url = link.get('url', '')
|
| 173 |
if url.startswith('https://huggingface.co/') or url.startswith('https://www.huggingface.co/'):
|
| 174 |
+
username = url.split('/')[-1]
|
| 175 |
+
print("Extracted username:", username)
|
| 176 |
+
return username
|
| 177 |
|
| 178 |
return None
|
| 179 |
|
| 180 |
|
|
|
|
| 181 |
def check_civit_link(profile: Optional[gr.OAuthProfile], url):
|
| 182 |
info, _ = process_url(url, download_files=False)
|
| 183 |
hf_username = extract_huggingface_username(info['creator'])
|
| 184 |
+
print(hf_username)
|
| 185 |
if(not hf_username):
|
| 186 |
no_username_text = 'Oops, your CivitAI profile seems to not have information about your Hugging Face account. Please visit <a href="https://civitai.com/user/account">https://civitai.com/user/account</a> and include it there<br><img width="60%" src="https://i.imgur.com/hCbo9uL.png" />'
|
| 187 |
return no_username_text, gr.update(), gr.update(visible=True)
|