Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,6 +3,7 @@ from gradio_client import Client, handle_file
|
|
| 3 |
import re
|
| 4 |
import time
|
| 5 |
import os
|
|
|
|
| 6 |
from dotenv import load_dotenv
|
| 7 |
|
| 8 |
# Load environment variables
|
|
@@ -17,7 +18,6 @@ client = Client(
|
|
| 17 |
hf_token=hf_token
|
| 18 |
)
|
| 19 |
|
| 20 |
-
|
| 21 |
def generate_outfit(model_image, garment_image, n_samples=1, n_steps=20, image_scale=2, seed=-1):
|
| 22 |
if model_image is None or garment_image is None:
|
| 23 |
return None, "Please upload both model and garment images"
|
|
@@ -59,6 +59,8 @@ def generate_outfit(model_image, garment_image, n_samples=1, n_steps=20, image_s
|
|
| 59 |
time.sleep(wait_seconds) # Wait before retrying
|
| 60 |
return None, f"GPU quota exceeded. Please wait {wait_time} before trying again."
|
| 61 |
else:
|
|
|
|
|
|
|
| 62 |
return None, f"Error: {str(e)}"
|
| 63 |
|
| 64 |
# Create Gradio interface
|
|
@@ -70,7 +72,6 @@ with gr.Blocks() as demo:
|
|
| 70 |
- Followed by selecting or uploading the garment you want to try-on.
|
| 71 |
- Next click Try Outfit button and wait
|
| 72 |
|
| 73 |
-
|
| 74 |
""")
|
| 75 |
|
| 76 |
with gr.Row():
|
|
@@ -79,7 +80,6 @@ with gr.Blocks() as demo:
|
|
| 79 |
label="Upload Model Image (person wearing clothes)",
|
| 80 |
type="filepath",
|
| 81 |
height=300
|
| 82 |
-
|
| 83 |
)
|
| 84 |
model_examples = [
|
| 85 |
"https://levihsu-ootdiffusion.hf.space/file=/tmp/gradio/ba5ba7978e7302e8ab5eb733cc7221394c4e6faf/model_5.png",
|
|
@@ -104,7 +104,6 @@ with gr.Blocks() as demo:
|
|
| 104 |
]
|
| 105 |
gr.Examples(examples=garment_examples, inputs=garment_image)
|
| 106 |
|
| 107 |
-
|
| 108 |
with gr.Column():
|
| 109 |
output_image = gr.Image(label="Generated Output")
|
| 110 |
error_text = gr.Markdown() # Add error display
|
|
|
|
| 3 |
import re
|
| 4 |
import time
|
| 5 |
import os
|
| 6 |
+
import traceback
|
| 7 |
from dotenv import load_dotenv
|
| 8 |
|
| 9 |
# Load environment variables
|
|
|
|
| 18 |
hf_token=hf_token
|
| 19 |
)
|
| 20 |
|
|
|
|
| 21 |
def generate_outfit(model_image, garment_image, n_samples=1, n_steps=20, image_scale=2, seed=-1):
|
| 22 |
if model_image is None or garment_image is None:
|
| 23 |
return None, "Please upload both model and garment images"
|
|
|
|
| 59 |
time.sleep(wait_seconds) # Wait before retrying
|
| 60 |
return None, f"GPU quota exceeded. Please wait {wait_time} before trying again."
|
| 61 |
else:
|
| 62 |
+
# Log the full traceback for debugging
|
| 63 |
+
traceback.print_exc()
|
| 64 |
return None, f"Error: {str(e)}"
|
| 65 |
|
| 66 |
# Create Gradio interface
|
|
|
|
| 72 |
- Followed by selecting or uploading the garment you want to try-on.
|
| 73 |
- Next click Try Outfit button and wait
|
| 74 |
|
|
|
|
| 75 |
""")
|
| 76 |
|
| 77 |
with gr.Row():
|
|
|
|
| 80 |
label="Upload Model Image (person wearing clothes)",
|
| 81 |
type="filepath",
|
| 82 |
height=300
|
|
|
|
| 83 |
)
|
| 84 |
model_examples = [
|
| 85 |
"https://levihsu-ootdiffusion.hf.space/file=/tmp/gradio/ba5ba7978e7302e8ab5eb733cc7221394c4e6faf/model_5.png",
|
|
|
|
| 104 |
]
|
| 105 |
gr.Examples(examples=garment_examples, inputs=garment_image)
|
| 106 |
|
|
|
|
| 107 |
with gr.Column():
|
| 108 |
output_image = gr.Image(label="Generated Output")
|
| 109 |
error_text = gr.Markdown() # Add error display
|