Update app.py
Browse files
app.py
CHANGED
|
@@ -41,7 +41,14 @@ import uuid # Import the UUID library
|
|
| 41 |
|
| 42 |
# Existing code...
|
| 43 |
|
| 44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
prompt_with_noise = add_random_noise(inputs, noise_level) + f" - {timestamp}"
|
| 46 |
while queue.qsize() >= queue_threshold:
|
| 47 |
time.sleep(2)
|
|
@@ -49,7 +56,10 @@ def send_it1(inputs, noise_level, timestamp=str(uuid.uuid4()), proc=proc1):
|
|
| 49 |
output = proc(prompt_with_noise)
|
| 50 |
return output
|
| 51 |
|
| 52 |
-
def get_prompts(prompt_text
|
|
|
|
|
|
|
|
|
|
| 53 |
if prompt_text:
|
| 54 |
return text_gen("dreamlikeart, " + prompt_text + f" - {timestamp}")
|
| 55 |
else:
|
|
@@ -57,6 +67,8 @@ def get_prompts(prompt_text, timestamp=str(uuid.uuid4())):
|
|
| 57 |
|
| 58 |
# Existing code...
|
| 59 |
|
|
|
|
|
|
|
| 60 |
with gr.Blocks(css='style.css') as demo:
|
| 61 |
gr.HTML("""
|
| 62 |
<div style="text-align: center; max-width: 650px; margin: 0 auto;">
|
|
|
|
| 41 |
|
| 42 |
# Existing code...
|
| 43 |
|
| 44 |
+
# Existing code...
|
| 45 |
+
|
| 46 |
+
request_counter = 0 # Global counter to track requests
|
| 47 |
+
|
| 48 |
+
def send_it1(inputs, noise_level, proc=proc1):
|
| 49 |
+
global request_counter
|
| 50 |
+
request_counter += 1
|
| 51 |
+
timestamp = f"{time.time()}_{request_counter}"
|
| 52 |
prompt_with_noise = add_random_noise(inputs, noise_level) + f" - {timestamp}"
|
| 53 |
while queue.qsize() >= queue_threshold:
|
| 54 |
time.sleep(2)
|
|
|
|
| 56 |
output = proc(prompt_with_noise)
|
| 57 |
return output
|
| 58 |
|
| 59 |
+
def get_prompts(prompt_text):
|
| 60 |
+
global request_counter
|
| 61 |
+
request_counter += 1
|
| 62 |
+
timestamp = f"{time.time()}_{request_counter}"
|
| 63 |
if prompt_text:
|
| 64 |
return text_gen("dreamlikeart, " + prompt_text + f" - {timestamp}")
|
| 65 |
else:
|
|
|
|
| 67 |
|
| 68 |
# Existing code...
|
| 69 |
|
| 70 |
+
# Existing code...
|
| 71 |
+
|
| 72 |
with gr.Blocks(css='style.css') as demo:
|
| 73 |
gr.HTML("""
|
| 74 |
<div style="text-align: center; max-width: 650px; margin: 0 auto;">
|