Update app.py
Browse files
app.py
CHANGED
|
@@ -31,12 +31,12 @@ import uuid # Import the UUID library
|
|
| 31 |
request_counter = 0 # Global counter to track requests
|
| 32 |
|
| 33 |
# Modify your send_it1 function to handle any errors generically
|
| 34 |
-
def send_it1(inputs, proc=proc1):
|
| 35 |
global request_counter
|
| 36 |
if not inputs.strip():
|
| 37 |
print("Please enter a prompt before generating an image.")
|
|
|
|
| 38 |
return None
|
| 39 |
-
|
| 40 |
request_counter += 1
|
| 41 |
timestamp = f"{time.time()}_{request_counter}"
|
| 42 |
prompt_with_noise = (inputs) + f" - {timestamp}"
|
|
@@ -49,7 +49,7 @@ def send_it1(inputs, proc=proc1):
|
|
| 49 |
return output
|
| 50 |
except Exception as e:
|
| 51 |
# Display a generic error message to the user
|
| 52 |
-
|
| 53 |
|
| 54 |
|
| 55 |
|
|
|
|
| 31 |
request_counter = 0 # Global counter to track requests
|
| 32 |
|
| 33 |
# Modify your send_it1 function to handle any errors generically
|
| 34 |
+
def send_it1(inputs, noise_level, style, proc=proc1):
|
| 35 |
global request_counter
|
| 36 |
if not inputs.strip():
|
| 37 |
print("Please enter a prompt before generating an image.")
|
| 38 |
+
raise gr.Error("Please enter a prompt before generating an image.")
|
| 39 |
return None
|
|
|
|
| 40 |
request_counter += 1
|
| 41 |
timestamp = f"{time.time()}_{request_counter}"
|
| 42 |
prompt_with_noise = (inputs) + f" - {timestamp}"
|
|
|
|
| 49 |
return output
|
| 50 |
except Exception as e:
|
| 51 |
# Display a generic error message to the user
|
| 52 |
+
raise gr.Error("Experiencing high demand. Please retry shortly. Thank you for your patience.")
|
| 53 |
|
| 54 |
|
| 55 |
|