Spaces:
Sleeping
Sleeping
Retry 5 times.
Browse files
app.py
CHANGED
@@ -287,7 +287,22 @@ examples = [
|
|
287 |
["three bedrooms with a kitchen adjacent to the dining room", "Medium"]
|
288 |
]
|
289 |
|
290 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
291 |
outputs=[generated, layout],
|
292 |
css=custom_css,
|
293 |
theme="default",
|
|
|
287 |
["three bedrooms with a kitchen adjacent to the dining room", "Medium"]
|
288 |
]
|
289 |
|
290 |
+
|
291 |
+
def retry_prompt_to_layout(user_prompt, intensity, fpath=None):
|
292 |
+
max_attempts = 5
|
293 |
+
attempts = 0
|
294 |
+
|
295 |
+
while attempts < max_attempts:
|
296 |
+
try:
|
297 |
+
# Call the original function
|
298 |
+
result = prompt_to_layout(user_prompt, intensity, fpath)
|
299 |
+
return result
|
300 |
+
except Exception as e:
|
301 |
+
print(f"Attempt {attempts+1} failed with error: {e}")
|
302 |
+
attempts += 1
|
303 |
+
|
304 |
+
|
305 |
+
iface = gr.Interface(fn=retry_prompt_to_layout, inputs=[textbox, creative_slider],
|
306 |
outputs=[generated, layout],
|
307 |
css=custom_css,
|
308 |
theme="default",
|