oauth
Browse files
README.md
CHANGED
|
@@ -9,6 +9,8 @@ app_file: app.py
|
|
| 9 |
pinned: false
|
| 10 |
license: other
|
| 11 |
short_description: Enhance hand features for flawless, natural-looking images
|
|
|
|
|
|
|
| 12 |
---
|
| 13 |
|
| 14 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 9 |
pinned: false
|
| 10 |
license: other
|
| 11 |
short_description: Enhance hand features for flawless, natural-looking images
|
| 12 |
+
|
| 13 |
+
hf_oauth: true
|
| 14 |
---
|
| 15 |
|
| 16 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
CHANGED
|
@@ -223,9 +223,12 @@ def image_to_base64(image):
|
|
| 223 |
return f"data:image/png;base64,{img_base64}"
|
| 224 |
|
| 225 |
|
| 226 |
-
def generate_image(edit_image_infos, did, request: gr.Request):
|
| 227 |
if not did:
|
| 228 |
did = str(uuid.uuid4())
|
|
|
|
|
|
|
|
|
|
| 229 |
if edit_image_infos is None or not isinstance(edit_image_infos, dict):
|
| 230 |
m = "Please upload the main image before generating."
|
| 231 |
return gr.Warning(m), did
|
|
@@ -464,6 +467,8 @@ with gr.Blocks(css=css) as WeShop:
|
|
| 464 |
outputs=[output, current_did],
|
| 465 |
concurrency_limit=None
|
| 466 |
)
|
|
|
|
|
|
|
| 467 |
with gr.Column():
|
| 468 |
main_image_middleware = gr.Image(
|
| 469 |
image_mode='RGBA',
|
|
|
|
| 223 |
return f"data:image/png;base64,{img_base64}"
|
| 224 |
|
| 225 |
|
| 226 |
+
def generate_image(edit_image_infos, did, request: gr.Request, oauth_token: gr.OAuthToken | None):
|
| 227 |
if not did:
|
| 228 |
did = str(uuid.uuid4())
|
| 229 |
+
if not oauth_token:
|
| 230 |
+
m = "Please log in to your Hugging Face account to use the features of this application."
|
| 231 |
+
return gr.Warning(m), did
|
| 232 |
if edit_image_infos is None or not isinstance(edit_image_infos, dict):
|
| 233 |
m = "Please upload the main image before generating."
|
| 234 |
return gr.Warning(m), did
|
|
|
|
| 467 |
outputs=[output, current_did],
|
| 468 |
concurrency_limit=None
|
| 469 |
)
|
| 470 |
+
with gr.Row():
|
| 471 |
+
gr.LoginButton()
|
| 472 |
with gr.Column():
|
| 473 |
main_image_middleware = gr.Image(
|
| 474 |
image_mode='RGBA',
|