summaryrefslogtreecommitdiff
path: root/Omni
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2024-12-03 17:52:52 -0500
committerBen Sima <ben@bsima.me>2024-12-21 10:08:04 -0500
commit47c48abf836f5918120c0550c57d4eda32d3f10e (patch)
treebff3572fc00c9f10f0e7758a24ff5d1fd01e78b1 /Omni
parentb3e113d2e1351ea1d48170a3433c2228ac2ae137 (diff)
Convert Biz/Storybook.py to Ludic
This is basically a full rewrite. I ripped out Flask and rearchitected the whole thing to use fully RESTful resources and endpoints using Ludic. The UI was completely redone to use Ludic's components. I added tests for everything that I reasonably could. This is almost ready for an alpha launch. Before shipping it I still need to: 1. generate images using image n-1 applied to `openai.images.create_variation()` 2. write a nix service, get it on a VM somewhere, I'll probably provision a new VM for this 3. replace the `db` thing with a real sqlite database I only need the first one done to show it to Lia and see if she likes it, that should be completed in a day or two. Then the nix service and deployment won't take long at all. Setting up a sqlite database will be annoying, but that I can't see that actually taking more than 2 days. So max 5 days out from launching this to friends and family.
Diffstat (limited to 'Omni')
-rw-r--r--Omni/Bild/Deps/Python.nix14
-rw-r--r--Omni/Log.py6
2 files changed, 16 insertions, 4 deletions
diff --git a/Omni/Bild/Deps/Python.nix b/Omni/Bild/Deps/Python.nix
index e36896a..9af4630 100644
--- a/Omni/Bild/Deps/Python.nix
+++ b/Omni/Bild/Deps/Python.nix
@@ -1 +1,13 @@
-[ "cryptography" "llm" "mypy" "nltk" "slixmpp" "flask" "openai" "ludic" ]
+[
+ "cryptography"
+ "flask"
+ "llm"
+ "ludic"
+ "mypy"
+ "nltk"
+ "openai"
+ "slixmpp"
+ "sqids"
+ "starlette"
+ "uvicorn"
+]
diff --git a/Omni/Log.py b/Omni/Log.py
index 2fbd007..e644a1a 100644
--- a/Omni/Log.py
+++ b/Omni/Log.py
@@ -1,6 +1,5 @@
"""Setup logging like Omni/Log.hs."""
-# noqa: builtin-attribute-shadowing
import logging
import typing
@@ -14,10 +13,10 @@ class LowerFormatter(logging.Formatter):
return super(logging.Formatter, self).format(record) # type: ignore[misc]
-def setup() -> None:
+def setup(level: int = logging.INFO) -> logging.Logger:
"""Run this in your __main__ function."""
logging.basicConfig(
- level=logging.DEBUG,
+ level=level,
format="%(levelname)s: %(name)s: %(message)s",
)
logging.addLevelName(logging.DEBUG, "dbug")
@@ -28,6 +27,7 @@ def setup() -> None:
handler = logging.StreamHandler()
handler.setFormatter(formatter)
logger.addHandler(handler)
+ return logger
if __name__ == "__main__":