Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -499,12 +499,12 @@ For more details, including weighting, merging and fusing LoRAs, check the [docu
|
|
499 |
|
500 |
|
501 |
def get_creator(username):
|
502 |
-
# Ensure
|
503 |
# Example: "__Host-next-auth.csrf-token=xxx; __Secure-next-auth.callback-url=yyy; __Secure-next-auth.session-token=zzz"
|
504 |
-
cookie_info = os.environ.get("
|
505 |
if not cookie_info:
|
506 |
-
print("
|
507 |
-
gr.Warning("
|
508 |
return None # Cannot proceed without cookie for this specific call
|
509 |
|
510 |
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"
|
@@ -708,9 +708,9 @@ def upload_civit_to_hf(profile: Optional[gr.OAuthProfile], oauth_token: Optional
|
|
708 |
raise gr.Error("No model weight file was downloaded. Cannot proceed with upload.")
|
709 |
|
710 |
# Determine if user is the author for README generation
|
711 |
-
# This relies on extract_huggingface_username which needs
|
712 |
is_author = False
|
713 |
-
if "
|
714 |
hf_username_on_civitai = extract_huggingface_username(info['creator'])
|
715 |
if hf_username_on_civitai and profile.username.lower() == hf_username_on_civitai.lower():
|
716 |
is_author = True
|
@@ -806,9 +806,7 @@ css = '''
|
|
806 |
|
807 |
with gr.Blocks(css=css, theme=gr.themes.Soft()) as demo: # Added a theme
|
808 |
gr.Markdown('''# Upload your CivitAI LoRA to Hugging Face 🤗
|
809 |
-
By uploading your LoRAs to Hugging Face you get diffusers compatibility, a free GPU-based Inference Widget (for many models)
|
810 |
-
listing in [LoRA Studio](https://lorastudio.co/models) after review, and the possibility to submit your model to [LoRA the Explorer](https://huggingface.co/spaces/multimodalart/LoraTheExplorer) ✨
|
811 |
-
**Important**: Ensure your `CIVITAI_COOKIE_INFO` environment variable is set if you want to automatically verify your Hugging Face username linked on your Civitai profile. This is required for non-trusted users.
|
812 |
''')
|
813 |
|
814 |
with gr.Row(elem_id="login_button_row"):
|
|
|
499 |
|
500 |
|
501 |
def get_creator(username):
|
502 |
+
# Ensure COOKIE_INFO is set as an environment variable
|
503 |
# Example: "__Host-next-auth.csrf-token=xxx; __Secure-next-auth.callback-url=yyy; __Secure-next-auth.session-token=zzz"
|
504 |
+
cookie_info = os.environ.get("COOKIE_INFO")
|
505 |
if not cookie_info:
|
506 |
+
print("COOKIE_INFO environment variable not set. Cannot fetch creator's HF username.")
|
507 |
+
gr.Warning("COOKIE_INFO not set. Cannot verify Hugging Face username on Civitai.")
|
508 |
return None # Cannot proceed without cookie for this specific call
|
509 |
|
510 |
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"
|
|
|
708 |
raise gr.Error("No model weight file was downloaded. Cannot proceed with upload.")
|
709 |
|
710 |
# Determine if user is the author for README generation
|
711 |
+
# This relies on extract_huggingface_username which needs COOKIE_INFO
|
712 |
is_author = False
|
713 |
+
if "COOKIE_INFO" in os.environ:
|
714 |
hf_username_on_civitai = extract_huggingface_username(info['creator'])
|
715 |
if hf_username_on_civitai and profile.username.lower() == hf_username_on_civitai.lower():
|
716 |
is_author = True
|
|
|
806 |
|
807 |
with gr.Blocks(css=css, theme=gr.themes.Soft()) as demo: # Added a theme
|
808 |
gr.Markdown('''# Upload your CivitAI LoRA to Hugging Face 🤗
|
809 |
+
By uploading your LoRAs to Hugging Face you get diffusers compatibility, a free GPU-based Inference Widget (for many models)
|
|
|
|
|
810 |
''')
|
811 |
|
812 |
with gr.Row(elem_id="login_button_row"):
|