| from models.pipeline import generate_image | |
| users = { | |
| "test@mail.com": {"credits": 5} | |
| } | |
| def create(prompt, email): | |
| if users[email]["credits"] <= 0: | |
| return "NO_CREDITS" | |
| image = generate_image(prompt) | |
| path = "static/output.png" | |
| image.save(path) | |
| users[email]["credits"] -= 1 | |
| return path |