oauth
Browse files
README.md
CHANGED
|
@@ -9,6 +9,8 @@ app_file: app.py
|
|
| 9 |
pinned: false
|
| 10 |
license: other
|
| 11 |
short_description: Transform flat-lay shots into on-model photos
|
|
|
|
|
|
|
| 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: Transform flat-lay shots into on-model photos
|
| 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
|
@@ -209,9 +209,12 @@ def load_description(file_path):
|
|
| 209 |
return content
|
| 210 |
|
| 211 |
|
| 212 |
-
def generate_image(main_image, background_image, did, request: gr.Request):
|
| 213 |
if not did:
|
| 214 |
did = str(uuid.uuid4())
|
|
|
|
|
|
|
|
|
|
| 215 |
if main_image is None or background_image is None:
|
| 216 |
m = "Please upload both the main image and the background reference image before generating."
|
| 217 |
return gr.Warning(m), did
|
|
@@ -405,6 +408,8 @@ with gr.Blocks(css=css) as WeShop:
|
|
| 405 |
outputs=[output, current_did],
|
| 406 |
concurrency_limit=None
|
| 407 |
)
|
|
|
|
|
|
|
| 408 |
with gr.Column():
|
| 409 |
show_case = gr.Examples(
|
| 410 |
examples=[
|
|
|
|
| 209 |
return content
|
| 210 |
|
| 211 |
|
| 212 |
+
def generate_image(main_image, background_image, did, request: gr.Request, oauth_token: gr.OAuthToken | None):
|
| 213 |
if not did:
|
| 214 |
did = str(uuid.uuid4())
|
| 215 |
+
if not oauth_token:
|
| 216 |
+
m = "Please log in to your Hugging Face account to use the features of this application."
|
| 217 |
+
return gr.Warning(m), did
|
| 218 |
if main_image is None or background_image is None:
|
| 219 |
m = "Please upload both the main image and the background reference image before generating."
|
| 220 |
return gr.Warning(m), did
|
|
|
|
| 408 |
outputs=[output, current_did],
|
| 409 |
concurrency_limit=None
|
| 410 |
)
|
| 411 |
+
with gr.Row():
|
| 412 |
+
gr.LoginButton()
|
| 413 |
with gr.Column():
|
| 414 |
show_case = gr.Examples(
|
| 415 |
examples=[
|