Spaces:
Runtime error
Runtime error
add numbering to images
Browse files
app.py
CHANGED
@@ -110,6 +110,7 @@ def download_all_images():
|
|
110 |
|
111 |
def generate_images(prompts, pw, model):
|
112 |
# Check for a valid password
|
|
|
113 |
if pw != os.getenv("PW"):
|
114 |
raise gr.Error("Invalid password. Please try again.")
|
115 |
|
@@ -120,7 +121,8 @@ def generate_images(prompts, pw, model):
|
|
120 |
# Split the prompts string into individual prompts based on semicolon separation
|
121 |
prompts_list = [prompt for prompt in prompts.split(';') if prompt]
|
122 |
|
123 |
-
for entry in prompts_list:
|
|
|
124 |
entry_parts = entry.split('-', 1) # Split by the first dash found
|
125 |
if len(entry_parts) == 2:
|
126 |
#raise gr.Error("Invalid prompt format. Please ensure it is in 'initials-prompt' format.")
|
@@ -150,7 +152,7 @@ def generate_images(prompts, pw, model):
|
|
150 |
|
151 |
image_url = response.data[0].url
|
152 |
# conditionally render the user to the label with the prompt
|
153 |
-
image_label = f"Prompt: {text}" if user_initials == "" else f"
|
154 |
|
155 |
try:
|
156 |
# Save the prompt, model, image URL, generation time and creation timestamp to the database
|
|
|
110 |
|
111 |
def generate_images(prompts, pw, model):
|
112 |
# Check for a valid password
|
113 |
+
|
114 |
if pw != os.getenv("PW"):
|
115 |
raise gr.Error("Invalid password. Please try again.")
|
116 |
|
|
|
121 |
# Split the prompts string into individual prompts based on semicolon separation
|
122 |
prompts_list = [prompt for prompt in prompts.split(';') if prompt]
|
123 |
|
124 |
+
for i, entry in enumerate(prompts_list):
|
125 |
+
print(i)
|
126 |
entry_parts = entry.split('-', 1) # Split by the first dash found
|
127 |
if len(entry_parts) == 2:
|
128 |
#raise gr.Error("Invalid prompt format. Please ensure it is in 'initials-prompt' format.")
|
|
|
152 |
|
153 |
image_url = response.data[0].url
|
154 |
# conditionally render the user to the label with the prompt
|
155 |
+
image_label = f"Prompt {i}: {text}" if user_initials == "" else f"Prompt {i}: {text}, User: {user_initials}"
|
156 |
|
157 |
try:
|
158 |
# Save the prompt, model, image URL, generation time and creation timestamp to the database
|