Update app.py
Browse files
app.py
CHANGED
|
@@ -35,7 +35,13 @@ def add_random_noise(prompt, noise_level=0.00):
|
|
| 35 |
prompt_list[index] = random.choice(noise_chars)
|
| 36 |
return "".join(prompt_list)
|
| 37 |
|
| 38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
prompt_with_noise = add_random_noise(inputs, noise_level) + f" - {timestamp}"
|
| 40 |
while queue.qsize() >= queue_threshold:
|
| 41 |
time.sleep(2)
|
|
@@ -43,12 +49,14 @@ def send_it1(inputs, noise_level, timestamp=str(time.time()), proc=proc1):
|
|
| 43 |
output = proc(prompt_with_noise)
|
| 44 |
return output
|
| 45 |
|
| 46 |
-
def get_prompts(prompt_text, timestamp=str(
|
| 47 |
if prompt_text:
|
| 48 |
return text_gen("dreamlikeart, " + prompt_text + f" - {timestamp}")
|
| 49 |
else:
|
| 50 |
return text_gen("", timestamp)
|
| 51 |
|
|
|
|
|
|
|
| 52 |
with gr.Blocks(css='style.css') as demo:
|
| 53 |
gr.HTML("""
|
| 54 |
<div style="text-align: center; max-width: 650px; margin: 0 auto;">
|
|
|
|
| 35 |
prompt_list[index] = random.choice(noise_chars)
|
| 36 |
return "".join(prompt_list)
|
| 37 |
|
| 38 |
+
# Existing code...
|
| 39 |
+
|
| 40 |
+
import uuid # Import the UUID library
|
| 41 |
+
|
| 42 |
+
# Existing code...
|
| 43 |
+
|
| 44 |
+
def send_it1(inputs, noise_level, timestamp=str(uuid.uuid4()), proc=proc1):
|
| 45 |
prompt_with_noise = add_random_noise(inputs, noise_level) + f" - {timestamp}"
|
| 46 |
while queue.qsize() >= queue_threshold:
|
| 47 |
time.sleep(2)
|
|
|
|
| 49 |
output = proc(prompt_with_noise)
|
| 50 |
return output
|
| 51 |
|
| 52 |
+
def get_prompts(prompt_text, timestamp=str(uuid.uuid4())):
|
| 53 |
if prompt_text:
|
| 54 |
return text_gen("dreamlikeart, " + prompt_text + f" - {timestamp}")
|
| 55 |
else:
|
| 56 |
return text_gen("", timestamp)
|
| 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;">
|