Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -58,6 +58,8 @@ headers = {
|
|
58 |
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36" # Example
|
59 |
}
|
60 |
|
|
|
|
|
61 |
def get_json_data(url):
|
62 |
url_split = url.split('/')
|
63 |
if len(url_split) < 5 or not url_split[4].isdigit():
|
@@ -501,14 +503,6 @@ For more details, including weighting, merging and fusing LoRAs, check the [docu
|
|
501 |
|
502 |
|
503 |
def get_creator(username):
|
504 |
-
# Ensure COOKIE_INFO is set as an environment variable
|
505 |
-
# Example: "__Host-next-auth.csrf-token=xxx; __Secure-next-auth.callback-url=yyy; __Secure-next-auth.session-token=zzz"
|
506 |
-
cookie_info = os.environ.get("COOKIE_INFO")
|
507 |
-
if not cookie_info:
|
508 |
-
print("COOKIE_INFO environment variable not set. Cannot fetch creator's HF username.")
|
509 |
-
gr.Warning("COOKIE_INFO not set. Cannot verify Hugging Face username on Civitai.")
|
510 |
-
return None # Cannot proceed without cookie for this specific call
|
511 |
-
|
512 |
url = f"https://civitai.com/api/trpc/user.getCreator?input=%7B%22json%22%3A%7B%22username%22%3A%22{username}%22%2C%22authed%22%3Atrue%7D%7D"
|
513 |
try:
|
514 |
response = requests.get(url, headers=headers, timeout=10)
|
|
|
58 |
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36" # Example
|
59 |
}
|
60 |
|
61 |
+
cookie_info = os.environ.get("COOKIE_INFO")
|
62 |
+
|
63 |
def get_json_data(url):
|
64 |
url_split = url.split('/')
|
65 |
if len(url_split) < 5 or not url_split[4].isdigit():
|
|
|
503 |
|
504 |
|
505 |
def get_creator(username):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
506 |
url = f"https://civitai.com/api/trpc/user.getCreator?input=%7B%22json%22%3A%7B%22username%22%3A%22{username}%22%2C%22authed%22%3Atrue%7D%7D"
|
507 |
try:
|
508 |
response = requests.get(url, headers=headers, timeout=10)
|