multimodalart HF staff commited on
Commit
c50ed1f
1 Parent(s): 2417ae8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -9,6 +9,7 @@ import uuid
9
  from typing import Optional
10
  import json
11
 
 
12
 
13
  def get_json_data(url):
14
  api_url = f"https://civitai.com/api/v1/models/{url.split('/')[4]}"
@@ -20,7 +21,9 @@ def get_json_data(url):
20
  print(f"Error fetching JSON data: {e}")
21
  return None
22
 
23
- def check_nsfw(json_data):
 
 
24
  if json_data["nsfw"]:
25
  return False
26
  for model_version in json_data["modelVersions"]:
@@ -179,6 +182,10 @@ def check_civit_link(profile: Optional[gr.OAuthProfile], url):
179
  info, _ = process_url(url, do_download=False)
180
  hf_username = extract_huggingface_username(info['creator'])
181
  attributes_methods = dir(profile)
 
 
 
 
182
  if(not hf_username):
183
  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)'
184
  return no_username_text, gr.update(interactive=False), gr.update(visible=True), gr.update(visible=False)
 
9
  from typing import Optional
10
  import json
11
 
12
+ TRUSTED_UPLOADERS = ["KappaNeuro", "CiroN2022"]
13
 
14
  def get_json_data(url):
15
  api_url = f"https://civitai.com/api/v1/models/{url.split('/')[4]}"
 
21
  print(f"Error fetching JSON data: {e}")
22
  return None
23
 
24
+ def check_nsfw(profile: Optional[gr.OAuthProfile], json_data):
25
+ if(profile.preferred_username in TRUSTED_UPLOADERS):
26
+ return True
27
  if json_data["nsfw"]:
28
  return False
29
  for model_version in json_data["modelVersions"]:
 
182
  info, _ = process_url(url, do_download=False)
183
  hf_username = extract_huggingface_username(info['creator'])
184
  attributes_methods = dir(profile)
185
+
186
+ if(profile.preferred_username == "multimodalart"):
187
+ return '', gr.update(interactive=True), gr.update(visible=False), gr.update(visible=True)
188
+
189
  if(not hf_username):
190
  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)'
191
  return no_username_text, gr.update(interactive=False), gr.update(visible=True), gr.update(visible=False)