Update app.py
Browse files
app.py
CHANGED
|
@@ -32,6 +32,11 @@ request_counter = 0 # Global counter to track requests
|
|
| 32 |
|
| 33 |
def send_it1(inputs, proc=proc1):
|
| 34 |
global request_counter
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
request_counter += 1
|
| 36 |
timestamp = f"{time.time()}_{request_counter}"
|
| 37 |
prompt_with_noise = (inputs) + f" - {timestamp}"
|
|
@@ -45,6 +50,7 @@ def send_it1(inputs, proc=proc1):
|
|
| 45 |
|
| 46 |
|
| 47 |
|
|
|
|
| 48 |
with gr.Blocks(css=".gradio-container {background-color: #FFF0F5;} footer{display:none !important;}",) as demo:
|
| 49 |
with gr.Column(elem_id="col-container"):
|
| 50 |
with gr.Row(variant="compact"):
|
|
|
|
| 32 |
|
| 33 |
def send_it1(inputs, proc=proc1):
|
| 34 |
global request_counter
|
| 35 |
+
if not inputs.strip(): # Check if the input text is empty or only contains whitespace
|
| 36 |
+
# Alert or stop image generation
|
| 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}"
|
|
|
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
+
|
| 54 |
with gr.Blocks(css=".gradio-container {background-color: #FFF0F5;} footer{display:none !important;}",) as demo:
|
| 55 |
with gr.Column(elem_id="col-container"):
|
| 56 |
with gr.Row(variant="compact"):
|