Spaces:
Running
Running
Commit
•
78994f5
1
Parent(s):
9f4249c
Update app.py
Browse files
app.py
CHANGED
@@ -181,20 +181,22 @@ 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 src="https://i.imgur.com/hCbo9uL.png" />'
|
185 |
-
return no_username_text, gr.update()
|
186 |
if(profile.name != hf_username):
|
187 |
unmatched_username_text = '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" />'
|
188 |
-
return unmatched_username_text, gr.update()
|
189 |
else:
|
190 |
-
return '', gr.update(interactive=True)
|
191 |
|
192 |
def swap_fill(profile: Optional[gr.OAuthProfile]):
|
193 |
if profile is None:
|
194 |
return gr.update(visible=True), gr.update(visible=False)
|
195 |
else:
|
196 |
return gr.update(visible=False), gr.update(visible=True)
|
197 |
-
|
|
|
|
|
198 |
css = '''
|
199 |
#login {
|
200 |
font-size: 0px;
|
@@ -227,7 +229,6 @@ with gr.Blocks(css=css) as demo:
|
|
227 |
label="CivitAI model URL",
|
228 |
info="URL of the CivitAI model, make sure it is a SDXL LoRA",
|
229 |
)
|
230 |
-
#is_author = gr.Checkbox(label="Are you the model author?", info="If you are not the author, a disclaimer with information about the author and the CivitAI source will be added", value=False)
|
231 |
submit_button_civit = gr.Button("Upload model to Hugging Face and submit")
|
232 |
output = gr.Textbox(label="Output progress")
|
233 |
with gr.Column(visible=False) as enabled_area:
|
@@ -236,14 +237,15 @@ with gr.Blocks(css=css) as demo:
|
|
236 |
label="CivitAI model URL",
|
237 |
info="URL of the CivitAI model, make sure it is a SDXL LoRA",
|
238 |
)
|
239 |
-
#is_author = gr.Checkbox(label="Are you the model author?", info="If you are not the author, a disclaimer with information about the author and the CivitAI source will be added", value=False)
|
240 |
instructions = gr.HTML("")
|
|
|
241 |
submit_button_civit = gr.Button("Upload model to Hugging Face", interactive=False)
|
242 |
-
output = gr.Textbox(label="Output progress")
|
243 |
|
244 |
demo.load(fn=swap_fill, outputs=[disabled_area, enabled_area])
|
245 |
-
submit_source_civit.change(fn=check_civit_link, inputs=[submit_source_civit], outputs=[instructions, submit_button_civit])
|
246 |
-
|
|
|
247 |
|
248 |
demo.queue()
|
249 |
demo.launch()
|
|
|
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)
|
186 |
if(profile.name != hf_username):
|
187 |
unmatched_username_text = '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" />'
|
188 |
+
return unmatched_username_text, gr.update(), gr.update(visible=True)
|
189 |
else:
|
190 |
+
return '', gr.update(interactive=True), gr.update(visible=False)
|
191 |
|
192 |
def swap_fill(profile: Optional[gr.OAuthProfile]):
|
193 |
if profile is None:
|
194 |
return gr.update(visible=True), gr.update(visible=False)
|
195 |
else:
|
196 |
return gr.update(visible=False), gr.update(visible=True)
|
197 |
+
|
198 |
+
def show_output():
|
199 |
+
return gr.update(visible=True)
|
200 |
css = '''
|
201 |
#login {
|
202 |
font-size: 0px;
|
|
|
229 |
label="CivitAI model URL",
|
230 |
info="URL of the CivitAI model, make sure it is a SDXL LoRA",
|
231 |
)
|
|
|
232 |
submit_button_civit = gr.Button("Upload model to Hugging Face and submit")
|
233 |
output = gr.Textbox(label="Output progress")
|
234 |
with gr.Column(visible=False) as enabled_area:
|
|
|
237 |
label="CivitAI model URL",
|
238 |
info="URL of the CivitAI model, make sure it is a SDXL LoRA",
|
239 |
)
|
|
|
240 |
instructions = gr.HTML("")
|
241 |
+
try_again_button = gr.Button("I have added my HF profile to my account", visible=False)
|
242 |
submit_button_civit = gr.Button("Upload model to Hugging Face", interactive=False)
|
243 |
+
output = gr.Textbox(label="Output progress", visible=False)
|
244 |
|
245 |
demo.load(fn=swap_fill, outputs=[disabled_area, enabled_area])
|
246 |
+
submit_source_civit.change(fn=check_civit_link, inputs=[submit_source_civit], outputs=[instructions, submit_button_civit, try_again_button])
|
247 |
+
try_again_button.change(fn=check_civit_link, inputs=[submit_source_civit], outputs=[instructions, submit_button_civit, try_again_button])
|
248 |
+
submit_button_civit.click(fn=show_output, inputs=[], outputs=[output]).then(fn=upload_civit_to_hf, inputs=[submit_source_civit], outputs=[output])
|
249 |
|
250 |
demo.queue()
|
251 |
demo.launch()
|