Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -79,9 +79,23 @@ def predict(prompt, guidance, steps, seed=1231231):
|
|
79 |
)
|
80 |
if nsfw_content_detected:
|
81 |
nsfw=gr.Button("🕹️NSFW🎨", scale=1)
|
82 |
-
|
83 |
-
|
84 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
|
86 |
|
87 |
css = """
|
|
|
79 |
)
|
80 |
if nsfw_content_detected:
|
81 |
nsfw=gr.Button("🕹️NSFW🎨", scale=1)
|
82 |
+
|
83 |
+
|
84 |
+
# Generate file name
|
85 |
+
date_str = datetime.datetime.now().strftime("%Y%m%d")
|
86 |
+
safe_prompt = prompt.replace(" ", "_")[:50] # Truncate long prompts
|
87 |
+
filename = f"{date_str}_{safe_prompt}.png"
|
88 |
+
|
89 |
+
# Save the image
|
90 |
+
if len(results.images) > 0:
|
91 |
+
image_path = os.path.join("path_to_save", filename) # Specify your directory
|
92 |
+
results.images[0].save(image_path)
|
93 |
+
print(f"Image saved as {image_path}")
|
94 |
+
|
95 |
+
return results.images[0] if len(results.images) > 0 else None
|
96 |
+
|
97 |
+
|
98 |
+
#return results.images[0]
|
99 |
|
100 |
|
101 |
css = """
|